Exemplo n.º 1
0
 public function inject()
 {
     if (!is_subclass_of($this->class, AbstractCacheManager::class)) {
         throw new SphringCacheException("Class must be a instance of %s for bean '%'.", AbstractCacheManager::class, $this->id);
     }
     parent::inject();
     $this->object->setCacheSphring($this->cacheSphring);
     $this->object->setCacheSphringProxies($this->cacheSphringProxies);
     $this->object->setCacheSphringContext($this->cacheSphringContext);
     $this->object->setCacheSphringBean($this->cacheSphringBean);
     $this->object->setCacheSphringAnnotation($this->cacheSphringAnnotation);
     SphringCacheRunnerPlugin::getInstance()->setCacheManager($this->object);
 }
Exemplo n.º 2
0
 /**
  * @param \ReflectionMethod[] $methods
  * @param AbstractBean $bean
  * @return array
  */
 private function getAfterCallMethod($methods, AbstractBean $bean)
 {
     $afterCall = [];
     foreach ($methods as $method) {
         $methodName = $method->getName();
         $afterCall[$methodName] = function ($proxy, $instance, $method, $params, $returnValue, &$returnEarly) use($methodName, $bean) {
             $annotationDispatcher = new AnnotationsDispatcher($bean, $bean->getClass(), $bean->getSphringEventDispatcher());
             $params['#result'] = $returnValue;
             $annotationDispatcher->setMethodArgs($params);
             if ($returnValue !== null) {
                 $returnEarly = true;
             }
             $toReturnAfter = $annotationDispatcher->dispatchAnnotationMethodCallAfter($methodName);
             if ($toReturnAfter !== null) {
                 $returnEarly = true;
                 $returnValue = $toReturnAfter;
             }
             return $returnValue;
         };
     }
     return $afterCall;
 }
Exemplo n.º 3
0
 /**
  * @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()]);
 }
Exemplo n.º 4
0
 public function inject()
 {
     parent::inject();
     $this->startMethodInit();
 }