I have a bundle with entity defined in it. I want to be able to configure this bundle in such a way, that this entity will or won't be relevant. So if bundle is configured properly entity table shouldn't be created with app/console doctrine:schema:update
etc, or should be - it should depend on configuration.
How to conditionally "disable" entity so its table won't be created by app/console doctrine:schema:update
?
Your scenario requires you to disable the auto_mapping
, but it seems to be set to false
by default. http://symfony.com/doc/current/reference/configuration/doctrine.html
Next thing to do is make sure the build
function of your bundle conditionally adds the wanted DoctrineOrmMappingPass
as also is explained here: https://stackoverflow.com/a/26975083/1794894
As you can see in the source, build
only is executed once the cache is empty so this is the place where you can do this. You can also take a look at how to add compiler passes there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With