protected function instantiateController($className) { $key = strtolower($className); if (!isset($this->controllerInstances[$key])) { $container = new Customweb_DependencyInjection_Container_Extendable($this->getContainer()); $bean = Customweb_DependencyInjection_Bean_Provider_Annotation_Util::createBeanInstance($className, $className); $container->addBean(new Customweb_DependencyInjection_Bean_Object($this->getAdapter())); $container->addBean(new Customweb_DependencyInjection_Bean_Object($this)); $this->controllerInstances[$key] = $bean->getInstance($container); } return $this->controllerInstances[$key]; }
/** * This method returns the payment method wrapper object. * * @param Customweb_Payment_Authorization_IPaymentMethod $method * @return object */ public function getPaymentMethod(Customweb_Payment_Authorization_IPaymentMethod $method, $authorizationMethodName) { $keys = $this->getKeys($method, $authorizationMethodName); $className = $this->resolveClassName($this->getClassMap(), $keys); if ($className === false) { throw new Customweb_Payment_Authorization_Method_PaymentMethodResolutionException($method->getPaymentMethodName(), $authorizationMethodName); } $instanceKey = implode('_', $keys); if (!isset($this->paymentMethodInstances[$instanceKey][$className])) { // We inject the given class as regular bean, but we do not store it back into the container. However, // we have to inject any required dependency. $bean = Customweb_DependencyInjection_Bean_Provider_Annotation_Util::createBeanInstance($className, $className); $container = new Customweb_DependencyInjection_Container_Extendable($this->getContainer()); $container->addBean(new Customweb_DependencyInjection_Bean_Object($method)); if (!isset($this->paymentMethodInstances[$instanceKey])) { $this->paymentMethodInstances[$instanceKey] = array(); } $this->paymentMethodInstances[$instanceKey][$className] = $bean->getInstance($container); } return $this->paymentMethodInstances[$instanceKey][$className]; }