Ejemplo n.º 1
0
 /**
  * Returns the current context
  *
  * @param boolean $locale True to add locale object to context, false if not (deprecated, use \Aimeos\Shop\Base\Locale)
  * @param string $type Configuration type, i.e. "frontend" or "backend" (deprecated, use \Aimeos\Shop\Base\Config)
  * @return \Aimeos\MShop\Context\Item\Iface Context object
  */
 public function get($locale = true, $type = 'frontend')
 {
     $config = $this->config->get($type);
     if ($this->context === null) {
         $context = new \Aimeos\MShop\Context\Item\Standard();
         $context->setConfig($config);
         $this->addDataBaseManager($context);
         $this->addFilesystemManager($context);
         $this->addMessageQueueManager($context);
         $this->addLogger($context);
         $this->addCache($context);
         $this->addMailer($context);
         $this->addSession($context);
         $this->addUser($context);
         $this->addGroups($context);
         $this->context = $context;
     }
     $this->context->setConfig($config);
     if ($locale === true) {
         $localeItem = $this->locale->get($this->context);
         $this->context->setLocale($localeItem);
         $this->context->setI18n($this->i18n->get(array($localeItem->getLanguageId())));
     }
     return $this->context;
 }
Ejemplo n.º 2
0
 /**
  * Returns the current context.
  *
  * @param \TYPO3\Flow\Mvc\RequestInterface $request Request object
  * @return \Aimeos\MShop\Context\Item\Iface
  */
 public function get(\TYPO3\Flow\Mvc\RequestInterface $request = null, $type = 'frontend')
 {
     $config = $this->config->get($type);
     if (self::$context === null) {
         $context = new \Aimeos\MShop\Context\Item\Standard();
         $context->setConfig($config);
         $this->addDataBaseManager($context);
         $this->addFilesystemManager($context);
         $this->addMessageQueueManager($context);
         $this->addLogger($context);
         $this->addCache($context);
         $this->addMailer($context);
         self::$context = $context;
     }
     $context = self::$context;
     $context->setConfig($config);
     if ($request !== null) {
         $localeItem = $this->locale->get($context, $request);
         $context->setI18n($this->i18n->get(array($localeItem->getLanguageId())));
         $context->setLocale($localeItem);
     }
     $this->addSession($context);
     $this->addUser($context);
     return $context;
 }