public function __construct(Customweb_DependencyInjection_IContainer $container) { $this->container = $container; $this->providerService = $container->getBean('Customweb_Payment_ExternalCheckout_IProviderService'); $this->entityManager = $container->getBean('Customweb_Database_Entity_IManager'); $this->transactionHandler = $container->getBean('Customweb_Payment_ITransactionHandler'); }
protected function postProcessActionInvocation($controllerObject, ReflectionMethod $method, array $arguements, Customweb_DependencyInjection_IContainer $container) { if ($container->hasBean('Customweb_Payment_Authorization_ITransaction')) { $transaction = $container->getBean('Customweb_Payment_Authorization_ITransaction'); $this->getTransactionHandler()->persistTransactionObject($transaction); } }
/** * Removes the given alias from the database. In case it can be also removed on the remote system it will be also * removed their. * * @param int $transactionId * @throws Exception */ public function removeAlias($transactionId) { $transaction = $this->manager->fetch($this->transactionClassName, $transactionId); if (!$transaction instanceof Customweb_Payment_Entity_AbstractTransaction) { throw new Exception("Transaction must be of type Customweb_Payment_Entity_AbstractTransaction"); } $this->deactivateAlias($transactionId); if ($this->container->hasBean('Customweb_Payment_Alias_IRemoveAdapter')) { $removeAdapter = $this->container->getBean('Customweb_Payment_Alias_IRemoveAdapter'); if (!$removeAdapter instanceof Customweb_Payment_Alias_IRemoveAdapter) { throw new Exception("Remove adapter must be of type 'Customweb_Payment_Alias_IRemoveAdapter'"); } $removeAdapter->remove($transaction->getTransactionObject()); $this->manager->persist($transaction); } }
/** * @param Customweb_Asset_IResolver $assetResolver * @param Customweb_DependencyInjection_IContainer $container */ public function __construct(Customweb_Asset_IResolver $assetResolver, Customweb_DependencyInjection_IContainer $container) { $this->assetResolver = $assetResolver; if ($container->hasBean('Customweb_Cache_IBackend')) { $this->cacheBackend = $container->getBean('Customweb_Cache_IBackend'); } }
protected function resolveInvocationArguements(ReflectionMethod $method, Customweb_DependencyInjection_IContainer $container) { $args = array(); foreach ($method->getParameters() as $parameter) { $type = self::getParameterType($parameter); if ($type === null) { throw new Customweb_Mvc_Controller_Exception_ActionArgumentScalarException($method->getName()); } try { $args[] = $container->getBean($type); } catch (Customweb_DependencyInjection_Exception_BeanNotFoundException $e) { throw new Customweb_Mvc_Controller_Exception_ActionArgumentNotResolvableException($method->getName(), $type); } } return $args; }
public function getInstanceByInject(Customweb_DependencyInjection_IContainer $container, $inject) { return $container->getBean($inject); }
public function getBean($identifier) { return $this->container->getBean($identifier); }