Skip to content

Instantly share code, notes, and snippets.

@arnaud-lb
Last active December 16, 2015 21:39
Show Gist options
  • Save arnaud-lb/5500901 to your computer and use it in GitHub Desktop.
Save arnaud-lb/5500901 to your computer and use it in GitHub Desktop.
Clear DoctrineExtensions entity wrapper cache when clearing entity manager
<?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();
}
}
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