コード例 #1
0
 public function testClearCacheAll()
 {
     $configProvider = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Provider\\ConfigProvider')->disableOriginalConstructor()->getMock();
     $cache = $this->getMockForAbstractClass('Doctrine\\Common\\Cache\\CacheProvider', array(), '', false, true, true, array('deleteAll'));
     $provider = new OwnershipMetadataProvider(array('organization' => 'AcmeBundle\\Entity\\Organization', 'business_unit' => 'AcmeBundle\\Entity\\BusinessUnit', 'user' => 'AcmeBundle\\Entity\\User'), $configProvider, null, $cache);
     $cache->expects($this->once())->method('deleteAll');
     $provider->clearCache();
 }
コード例 #2
0
 /**
  * @param PersistConfigEvent $event
  */
 public function prePersistEntityConfig(PersistConfigEvent $event)
 {
     $event->getConfigManager()->calculateConfigChangeSet($event->getConfig());
     $changes = $event->getConfigManager()->getConfigChangeSet($event->getConfig());
     $isDeleted = false;
     // Now if you press delete entity button, in state variable, in 1st position will be "Deleted" string.
     // If you press restore entity, then "Deleted" string will be at 0 position.
     if (isset($changes['state']) && $changes['state'][1] === 'Deleted') {
         $isDeleted = true;
     }
     $cp = $event->getConfigManager()->getProvider('ownership');
     $className = $event->getConfig()->getId()->getClassName();
     if ($cp->hasConfig($className)) {
         $this->provider->clearCache($className);
         if (!$isDeleted) {
             $this->provider->warmUpCache($className);
         }
     }
 }
コード例 #3
0
 /**
  * {inheritdoc}
  */
 public function clear($cacheDir)
 {
     $this->provider->clearCache();
 }