The problem is that, for example, the default template engine for symfony2 twig needs these methods. Twig converts the statement {{ object.property }} to $object->getProperty() , so instead of using very nice dot notation, you will have to call the properties in twig like this: {{ object.__get("property") }} .
I know that doctrine also uses magic methods in this entity manager. Therefore, when you create a repository request for an object that you can use:
$repository->findOneByProperty($value);
instead
$repository->findOneBy(array( 'property' => $value ));
I would really like you to not use magic methods, but instead use the get and set method for each property separately. It will also give you more control over the state of this property.
Also be sure to check this answer . This pretty much also answers your question.
source share