Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To use annotations, files must be removed #6251

Closed
wants to merge 2 commits into from
Closed

To use annotations, files must be removed #6251

wants to merge 2 commits into from

Conversation

pbowyer
Copy link
Contributor

@pbowyer pbowyer commented Feb 10, 2016

Q A
Doc fix? yes
New docs? no
Applies to Tested on 3.0
Fixed tickets N/A

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.

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.
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
<http://symfony.com/doc/current/book/doctrine.html#add-mapping-information>`_.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition is nice, but we should use the ref role to link to that section like this (I would also reword this a bit):

If you want to use annotations, you must remove the XML (or YAML) files
after running these two commands. This is necessary as
:ref:`it is not possible to mix mapping configuration formats <book-doctrine-adding-mapping>`.

@OskarStark
Copy link
Contributor

this should be merged to prior branches, too

what do you think @xabbuh ?

@xabbuh
Copy link
Member

xabbuh commented Feb 11, 2016

Yes, we will do that when merging the PR.

@OskarStark
Copy link
Contributor

👍

@pbowyer
Copy link
Contributor Author

pbowyer commented Feb 17, 2016

Thanks @xabbuh I've updated the PR in line with your comment.

@xabbuh
Copy link
Member

xabbuh commented Feb 17, 2016

👍

weaverryan added a commit that referenced this pull request Feb 21, 2016
This PR was submitted for the 3.0 branch but it was merged into the 2.3 branch instead (closes #6251).

Discussion
----------

To use annotations, files must be removed

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | Tested on 3.0
| Fixed tickets | N/A

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.

Commits
-------

06de6c0 Updated per xabbuh's comment
6a526bf To use annotations, files must be removed
weaverryan added a commit that referenced this pull request Feb 21, 2016
@weaverryan
Copy link
Member

Thanks Peter! I merged this into the 2.3 branch and changed the block also to be a caution. I have seen this issue several times with people - very difficult to debug indeed!

@weaverryan weaverryan closed this Feb 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants