/** * Remove envelope for $beanName * * @param $beanName * * @throws OvoContainerException */ public function removeBeanEnvelope($beanName) { $this->logger->debug('Find and remove bean envelope for bean with name ' . $beanName); $beanClass = $this->contextReader->getBeanClass($beanName); $beanScope = $this->contextReader->getBeanScope($beanName); $id = $this->getInternalReferenceId($beanClass, $beanName, $beanScope, $this->contextReferenceId); if (isset($this->beanEnvelopeRepository[$id])) { $this->logger->debug('Remove bean envelope with id ' . $id); unset($this->beanEnvelopeRepository[$id]); } }
/** * Method to pre-create all beans scoped as SINGLETON or the beans with init-on-load set to TRUE * during the first time application boot * * @param ContextReader $contextReader * * return void */ private function initBeans(ContextReader $contextReader) { $this->logger->debug('Pre-Load all init-on-boot beans'); $beansToPreload = $contextReader->getInitBeans(); $this->preLoadedBeansRepository = new SimplePreLoadedBeansRepositoryImpl(); if ($beansToPreload != null) { foreach ($beansToPreload as $bean) { try { $this->preLoadedBeansRepository->addBean($bean, $this->coreContainer->getBean($bean)); } catch (OvoContainerException $e) { $this->coreContainer->close(); throw new OvoLoaderException($e->getMessage()); } } } }