Where are setters/getters when using YAML/XML mapping for Doctrine in Symfony?

In Symfony2, when adding mapping information to tell Doctrine how to map my entity to the database, if I use YAML or XML format instead of PHP annotations, how/where do I write getters/setters/other functions?


you can define mapping in yml or xml and still define entity class methods in the .php

Symfony Docs

Symfony docs show the metadata as annotations directly inside the Product class (option #1 PHP) at a different location src/AppBundle/Entity/Product.php than alternative (option #2 YAML and #3 XML) src/AppBundle/Resources/config/doctrine/Product.orm.*ml. This suggests that you can define the mapping in *ml and the getters/setters/other functions in the php.

Notice in the docs example the AppBundle\Entity\Product is specified in both files. The class methods and mapping can be defined independently and related to each other as AppBundle\Entity\Product.


Also note, this other question is misleading. You DO have to write getters/setters even if you use YAML/XML, as this answer clarifies:

Doctrine requires private/protected properties, so you'll still be writing getters and setters. And you'll still be writing the mapping info, just in another place.

Need Your Help

Office Communicator Crashes when opened

microsoft-office office-communicator-2007

Since yesterday, the moment I open Office Communicator 2007 r2, it crashes. It appears momentarily in task manager and disappears. Reinstalling didn't help. How to get to root cause of this issue?

how to disable focus selection in the tab bar item?

uitabbarcontroller swift2 tvos apple-tv

The menu items at the top are selected on roll over. I’ll like the user to highlight an item and then click it to select it.