private function cacheProxy() { $proxiesFolder = new Folder(sys_get_temp_dir() . DIRECTORY_SEPARATOR . SphringCacheEnum::CACHE_FOLDER . DIRECTORY_SEPARATOR . SphringCacheEnum::CACHE_FOLDER_PROXIES); $proxiesFolder->create(); $proxyManagerConfiguration = new Configuration(); $proxyManagerConfiguration->setProxiesTargetDir($proxiesFolder->absolute()); $proxyFactory = new AccessInterceptorValueHolderFactory($proxyManagerConfiguration); ProxyGenerator::getInstance()->setProxyFactory($proxyFactory); spl_autoload_register($proxyManagerConfiguration->getProxyAutoloader()); }
/** * @param AbstractBean $bean */ public function addBean(AbstractBean $bean) { $this->beans[$bean->getId()] = $bean; $bean->inject(); $this->proxyBeans[$bean->getId()] = ProxyGenerator::getInstance()->proxyFromBean($bean); $bean->setObject($this->proxyBeans[$bean->getId()]); }