1

Doctrine offers three ways to define the object mapping properties: in XML, in YAML and as inline docblock annotations in the code. The Doctrine documentation doesn't give any advice on choosing among them, but I'm specifically wondering if there is a generally accepted for best practice with regard to keeping mapping metadata for an ORM system in the file where the objects are defined versus keeping it in a separate data file. Is there?

2

I don't think so.

The different options are there to satisfy developers' personal preferences. Some people don't like XML, preferring something a bit simpler and more straightforward like YAML. Annotations are a nice way to add ORM capability to code that already exists.

It certainly seems to be in keeping with PHP's philosophy of "There's more than one way to do it, and the more ways the better."

  • +1 Just as long as you put whatever file you use under source control :-) – Marjan Venema Sep 25 '13 at 9:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.