/** * Release bean $beanName * * @param BeanEnvelope $beanStructure the name of the bean * @param string $contextReferenceId the context application id * * @throws OvoCircularDependencyException */ public static function release(BeanEnvelope $beanStructure, $contextReferenceId) { $beanName = $beanStructure->getName(); if (!isset(self::$repository[$contextReferenceId][$beanName]) and $beanStructure->getScope() == ScopeValue::PROTOTYPE) { $schema = join(self::ARROW, self::$repository[$contextReferenceId]); throw new OvoCircularDependencyException('Dependency error [maybe Circular dependency?][' . $schema . self::ARROW . $beanName . ']'); } unset(self::$repository[$contextReferenceId][$beanName]); }
/** * Decorate the bean with the dependencies. Call init method, if exists * * @param BeanEnvelope $beanEnvelope the Object that describe the bean "structure" * * @return void */ private function decorateBean(BeanEnvelope $beanEnvelope) { $this->logger->debug('Decorate bean ' . $beanEnvelope->getName() . ' and scope ' . $beanEnvelope->getScope()); $this->resolveDependencies($beanEnvelope); $this->callInitMethod($beanEnvelope); $this->registerDestroyMethod($beanEnvelope); }