Michaël Perrin has written an article about using annotation and filters improve security.
With a more complex model, for example an order that contains products, you want also to filter on the associations of the filtered entity.
Michaël Perrin has written an article about using annotation and filters improve security.
With a more complex model, for example an order that contains products, you want also to filter on the associations of the filtered entity.
CREATE FUNCTION distance (lat1 REAL, lng1 REAL, lat2 REAL, lng2 REAL) | |
RETURNS REAL DETERMINISTIC | |
RETURN 2 * 6371 * ASIN(SQRT( | |
SIN(RADIANS(lat1 - lat2)/2) * SIN(RADIANS(lat1 - lat2)/2) + | |
COS(RADIANS(lat1)) * COS(RADIANS(lat2)) * | |
SIN(RADIANS(lng1 - lng2)/2) * SIN(RADIANS(lng1 - lng2)/2) | |
)); |
Altough the Doctrine documentation about Working with associations states: "proper bidirectional association management in plain OOP is a non-trivial task and encapsulating all the details inside the classes can be challenging" I've used the following management methods (getters. setters, adders and removers) quite successfully.