1

I want to make doctrine use only the annotations existing inside the entity class (Not YAML).

When I execute: php app/console doctrine:schema:update , I get the error message:

Invalid mapping file 'TEST.Bundle.BlogBundle.Entity.Image.orm.yml' for clas
s 'TEST\Bundle\BlogBundle\Entity\Image'.

The file TEST.Bundle.BlogBundle.Entity.Image.orm.yml is empty. What can be the causes behind this error?

How can I tell doctrine to take into consideration the metadata specified by annotations?

Thank you very much.

1
  • 1
    Which version of PHP do you use? Commented Jan 21, 2014 at 16:44

1 Answer 1

3

Delete the file:

TEST.Bundle.BlogBundle.Entity.Image.orm.yml

Note: based on Symfony2 Docs

"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."
Sign up to request clarification or add additional context in comments.

9 Comments

After using your answer, the problem is resolved. however, I want to ask a question. Can I, under the same project, use YAML for some entities and annotations for others? If both are used for an enitity, is YAML always prior?
Actually, I got No mapping file found named error under my browser. I think I need to specify in configuration that I should use annotations for that specific entity and keep YAML for the others. right?
About different formats, try to ask another question, maybe it possibly to do. But better stick to one format
Thanks. So different bundle can have different formats. Try to use different bundles for your entities for your aims
Use code generators. I use NetBeans which can simplicity execute symfony commands for create bundles, entities, etc.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.