コード例 #1
0
ファイル: Factory.php プロジェクト: datavoyager/vufind
 /**
  * Construct the ProxyManager configuration.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return \ProxyManager\Configuration
  */
 public static function getProxyConfig(ServiceManager $sm)
 {
     $config = new \ProxyManager\Configuration();
     $cacheManager = $sm->get('VuFind\\CacheManager');
     $dir = $cacheManager->getCacheDir() . 'objects';
     $config->setProxiesTargetDir($dir);
     if (APPLICATION_ENV != 'development') {
         spl_autoload_register($config->getProxyAutoloader());
     }
     return $config;
 }
コード例 #2
0
ファイル: EntityManager.php プロジェクト: bravo3/orm
 /**
  * Create a new entity manager
  *
  * @param DriverInterface        $driver
  * @param MapperInterface        $mapper
  * @param SerialiserMap          $serialiser_map
  * @param KeySchemeInterface     $key_scheme
  * @param Configuration          $configuration
  * @param EntityCachingInterface $cache
  * @return EntityManager
  */
 public static function build(DriverInterface $driver, MapperInterface $mapper, SerialiserMap $serialiser_map = null, KeySchemeInterface $key_scheme = null, Configuration $configuration = null, EntityCachingInterface $cache = null)
 {
     $em_conf = $configuration ?: new Configuration();
     $proxy_conf = new \ProxyManager\Configuration();
     $proxy_conf->setProxiesTargetDir($em_conf->getCacheDir());
     $proxy_conf->setProxiesNamespace(Writer::PROXY_NAMESPACE);
     $proxy_factory = new AccessInterceptorValueHolderFactory($proxy_conf);
     $interceptor_factor = new EntityManagerInterceptorFactory();
     $em = new self($driver, $mapper, $serialiser_map, $key_scheme, $em_conf, $cache);
     $proxy = $proxy_factory->createProxy($em, $interceptor_factor->getPrefixInterceptors(), $interceptor_factor->getSuffixInterceptors());
     $em->setProxy($proxy);
     return $proxy;
 }