You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the Doctrine filters can be added to EntityManager's Configuration object by providing them in configuration array as:
'filters' => [
'filter-name' => 'FilterClass'
]
However, they're disabled by default and need to be explicitly enabled by calling $entityManager->getFilters()->enable('filter-name')
Usually, I'd put filters initialization in Module, that implements BootstrapListenerInterface, inside the onBootstrap() function but if application uses laminas-cli this function won't be called as laminas-cli doesn't lift the whole app.
In ideal scenario filters should be configured and enabled in one place and it should work for both web and cli. Just like it works in
Doctrine Bundle for Symfony.
I looked in EntityManager internals and the $filterCollection property is initialized only on the first call of getFilters(), hence filters can be enabled only after EntityManager was instantiated.
So what's the opinion about it, should it be in scope of DoctrineORMModule to enable filters like Doctrine Bundle for Symfony does or it's up to users to enable them ?
The text was updated successfully, but these errors were encountered:
I think the Laminas way to do this is to subscribe to a modules post load function to do fine-grained configuration. I think this is an interesting question.
Currently the Doctrine filters can be added to EntityManager's Configuration object by providing them in configuration array as:
However, they're disabled by default and need to be explicitly enabled by calling $entityManager->getFilters()->enable('filter-name')
Usually, I'd put filters initialization in Module, that implements BootstrapListenerInterface, inside the onBootstrap() function but if application uses laminas-cli this function won't be called as laminas-cli doesn't lift the whole app.
In ideal scenario filters should be configured and enabled in one place and it should work for both web and cli. Just like it works in
Doctrine Bundle for Symfony.
I looked in EntityManager internals and the $filterCollection property is initialized only on the first call of getFilters(), hence filters can be enabled only after EntityManager was instantiated.
So what's the opinion about it, should it be in scope of DoctrineORMModule to enable filters like Doctrine Bundle for Symfony does or it's up to users to enable them ?
The text was updated successfully, but these errors were encountered: