Last active
December 16, 2015 21:39
-
-
Save arnaud-lb/5500901 to your computer and use it in GitHub Desktop.
Clear DoctrineExtensions entity wrapper cache when clearing entity manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Doctrine\ORM\Event\OnClearEventArgs; | |
use Gedmo\Tool\Wrapper\AbstractWrapper; | |
/** | |
* Register the listener with $em->getEventManager()->addEventListener('onClear', new ClearListener()) | |
*/ | |
class ClearListener | |
{ | |
public function onClear(OnClearEventArgs $args) | |
{ | |
AbstractWrapper::clear(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear_listener: | |
class: ClearListener | |
tags: | |
# add to all connections | |
- {name: doctrine.event_listener, event: onClear} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment