Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.2k
Description
In theEntities & Entity Mapping section ofHow to Override any Part of a Bundle, the following is stated:
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.
I believe this is not completely true. If the bundle is defining the mapping in configuration files, it is possible to override the files, and thus the mapping. There is one caveat though: all mapping configuration files of the bundle must be overridden, you can't override just one of them.
I just tried it withJMSPaymentCoreBundle and it does work. I copied all the mapping files intoapp/Resources/config/JMSPaymentCoreBundle
and then set the following configuration:
# app/config/config.ymlorm:auto_generate_proxy_classes:"%kernel.debug%"naming_strategy:doctrine.orm.naming_strategy.underscoreauto_mapping:truemappings:JMSPaymentCoreBundle:mapping:truetype:xmldir:'%kernel.root_dir%/../app/Resources/config/JMSPaymentCoreBundle'alias:'JMSPaymentCoreBundle'prefix:'JMS\Payment\CoreBundle\Entity'
If I then alter something in one of the mapping files and runbin/console doctrine:schema:update
, I can see my changes are there.
Would it be useful to clarify this in the docs?