Bertuz
Bertuz

Reputation: 2566

override mapping for a specific Entity class

I'm using a standard Symfony 2.8 framework with Doctrine. My entities' mappings are all annotated, but I would need to map a single entity by using the PHP way (by defining loadMetadata static method) . I know there's a way to override a mapping Bundle configuration like explained here, but what I would like is specifying a single Entity. Is that possible? Thanks

Upvotes: 0

Views: 710

Answers (1)

Mz1907
Mz1907

Reputation: 665

No you can't mix the formats

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.

see doc here: http://symfony.com/doc/current/doctrine.html

if you really need to change the mapping format then I suggest you create a new bundle for your specific entity. I also had this problem. I wished to have different mapping format (yml and annotation in my case) but I had to create a new bundle.

Upvotes: 1

Related Questions