Adib Aroui
Adib Aroui

Reputation: 5065

Use only annotations to define mapping rules for doctrine

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.

Upvotes: 1

Views: 712

Answers (1)

Victor Bocharsky
Victor Bocharsky

Reputation: 12306

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."

Upvotes: 3

Related Questions