protected function applySecondLevelCacheSettingsToConfiguration(array $configuredSettings, Configuration $doctrineConfiguration)
    {
        if (!isset($configuredSettings['enable']) || $configuredSettings['enable'] !== true) {
            return;
        }

        $doctrineConfiguration->setSecondLevelCacheEnabled();
        $regionsConfiguration = $doctrineConfiguration->getSecondLevelCacheConfiguration()->getRegionsConfiguration();
        if (isset($configuredSettings['defaultLifetime'])) {
            $regionsConfiguration->setDefaultLifetime($configuredSettings['defaultLifetime']);
        }
        if (isset($configuredSettings['defaultLockLifetime'])) {
            $regionsConfiguration->setDefaultLockLifetime($configuredSettings['defaultLockLifetime']);
        }

        if (isset($configuredSettings['regions']) && is_array($configuredSettings['regions'])) {
            foreach ($configuredSettings['regions'] as $regionName => $regionLifetime) {
                $regionsConfiguration->setLifetime($regionName, $regionLifetime);
            }
        }

        $cache = new CacheAdapter();
        // must use ObjectManager in compile phase...
        $cache->setCache($this->objectManager->get(CacheManager::class)->getCache('Flow_Persistence_Doctrine_SecondLevel'));

        $factory = new \Doctrine\ORM\Cache\DefaultCacheFactory($regionsConfiguration, $cache);
        $doctrineConfiguration->getSecondLevelCacheConfiguration()->setCacheFactory($factory);
    }
protected function applySecondLevelCacheSettingsToConfiguration(array $configuredSettings, Configuration $doctrineConfiguration)
    {
        if (!isset($configuredSettings['enable']) || $configuredSettings['enable'] !== true) {
            return;
        }

        $doctrineConfiguration->setSecondLevelCacheEnabled();
        $regionsConfiguration = $doctrineConfiguration->getSecondLevelCacheConfiguration()->getRegionsConfiguration();
        if (isset($configuredSettings['defaultLifetime'])) {
            $regionsConfiguration->setDefaultLifetime($configuredSettings['defaultLifetime']);
        }
        if (isset($configuredSettings['defaultLockLifetime'])) {
            $regionsConfiguration->setDefaultLockLifetime($configuredSettings['defaultLockLifetime']);
        }

        if (isset($configuredSettings['regions']) && is_array($configuredSettings['regions'])) {
            foreach ($configuredSettings['regions'] as $regionName => $regionLifetime) {
                $regionsConfiguration->setLifetime($regionName, $regionLifetime);
            }
        }

        $cache = new CacheAdapter();
        // must use ObjectManager in compile phase...
        $cache->setCache($this->objectManager->get(CacheManager::class)->getCache('Flow_Persistence_Doctrine_SecondLevel'));

        $factory = new \Doctrine\ORM\Cache\DefaultCacheFactory($regionsConfiguration, $cache);
        $doctrineConfiguration->getSecondLevelCacheConfiguration()->setCacheFactory($factory);
    }
protected function applySecondLevelCacheSettingsToConfiguration ( array $ configuredSettings , Configuration $ doctrineConfiguration ) { if ( ! isset ( $ configuredSettings [ 'enable' ] ) || $ configuredSettings [ 'enable' ] !== true ) { return ; } $ doctrineConfiguration -> setSecondLevelCacheEnabled ( ) ; $ regionsConfiguration = $ doctrineConfiguration -> getSecondLevelCacheConfiguration ( ) -> getRegionsConfiguration ( ) ; if ( isset ( $ configuredSettings [ 'defaultLifetime' ] ) ) { $ regionsConfiguration -> setDefaultLifetime ( $ configuredSettings [ 'defaultLifetime' ] ) ; } if ( isset ( $ configuredSettings [ 'defaultLockLifetime' ] ) ) { $ regionsConfiguration -> setDefaultLockLifetime ( $ configuredSettings [ 'defaultLockLifetime' ] ) ; } if ( isset ( $ configuredSettings [ 'regions' ] ) && is_array ( $ configuredSettings [ 'regions' ] ) ) { foreach ( $ configuredSettings [ 'regions' ] as $ regionName => $ regionLifetime ) { $ regionsConfiguration -> setLifetime ( $ regionName , $ regionLifetime ) ; } } $ cache = new CacheAdapter ( ) ; // must use ObjectManager in compile phase... $ cache -> setCache ( $ this -> objectManager -> get ( CacheManager :: class ) -> getCache ( 'Flow_Persistence_Doctrine_SecondLevel' ) ) ; $ factory = new \ Doctrine \ ORM \ Cache \ DefaultCacheFactory ( $ regionsConfiguration , $ cache ) ; $ doctrineConfiguration -> getSecondLevelCacheConfiguration ( ) -> setCacheFactory ( $ factory ) ; }
Apply configured settings regarding Doctrine's second level cache.

@param array $configuredSettings
@param Configuration $doctrineConfiguration
@return void
Apply configured settings regarding Doctrine s second level cache .