From a854a8324aa40f007dd97433c33e623353759927 Mon Sep 17 00:00:00 2001 From: Peter Bowyer Date: Wed, 10 Feb 2016 10:01:17 +0000 Subject: [PATCH 1/2] To use annotations, files must be removed I'm proposing this change after spending an hour trying to work out why my Repository class wasn't loading. Thanks to `ysor123` on IRC, we diagnosed the problem was the XML mapping files generated when reverse engineering my database, which I hadn't deleted. This is obliquely referred to at http://symfony.com/doc/current/book/doctrine.html#add-mapping-information: > A bundle can accept only one metadata definition format. For example, it's not possible to mix YAML metadata definitions with annotated PHP entity class definitions. It'd be great to clarify this for future readers. --- cookbook/doctrine/reverse_engineering.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbook/doctrine/reverse_engineering.rst b/cookbook/doctrine/reverse_engineering.rst index efa393a0beb..e7817632f48 100644 --- a/cookbook/doctrine/reverse_engineering.rst +++ b/cookbook/doctrine/reverse_engineering.rst @@ -101,8 +101,10 @@ execute the second command only. .. tip:: - If you want to use annotations, you can safely delete the XML (or YAML) files - after running these two commands. + If you want to use annotations, you must remove the XML (or YAML) files + after running these two commands. It is `not possible to mix XML/YAML metadata + definitions with annotated PHP entity class definitions + `_. For example, the newly created ``BlogComment`` entity class looks as follow:: From e9162a73728a86b6116b3b9811b385efae3fb062 Mon Sep 17 00:00:00 2001 From: Peter Bowyer Date: Wed, 17 Feb 2016 10:41:04 +0000 Subject: [PATCH 2/2] Updated per xabbuh's comment --- cookbook/doctrine/reverse_engineering.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cookbook/doctrine/reverse_engineering.rst b/cookbook/doctrine/reverse_engineering.rst index e7817632f48..39acef9da23 100644 --- a/cookbook/doctrine/reverse_engineering.rst +++ b/cookbook/doctrine/reverse_engineering.rst @@ -102,9 +102,8 @@ execute the second command only. .. tip:: If you want to use annotations, you must remove the XML (or YAML) files - after running these two commands. It is `not possible to mix XML/YAML metadata - definitions with annotated PHP entity class definitions - `_. + after running these two commands. This is necessary as + :ref:`it is not possible to mix mapping configuration formats ` For example, the newly created ``BlogComment`` entity class looks as follow::