A
A
Alexey Krichko2014-03-14 14:42:25
symfony
Alexey Krichko, 2014-03-14 14:42:25

Symfony2 - how to override an entity?

There is a bundle, it has related entities in the Entity folder, configuration with annotations. I need to redefine a couple of mappings, add a couple of properties and methods. The docs say:
Due to the way Doctrine works, it is not possible to override entity mapping of a bundle. However, if a bundle provides a mapped superclass (such as the User entity in the FOSUserBundle) one can override attributes and associations. Learn more about this feature and its limitations in the Doctrine documentation.
Actually, the bundle itself was written, so answers are welcome, including changes to the bundle itself.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery, 2014-03-20
@Akuma

The docs mean that if you inherit from a class that is MappedSuperClass, you can override properties or methods. But just redefining the entity will not work. As an option - try to play around with aliases for entities, i.e. create your own alias of type MySuperApp:Entity, and define the path to it dynamically. But to be honest, I doubt it will work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question