/** * Returns the current context * * @param boolean $locale True to add locale object to context, false if not * @return \Aimeos\MShop\Context\Item\Iface Context object */ public function get($locale = true) { if (self::$context === null) { $context = new \Aimeos\MShop\Context\Item\Standard(); $config = $this->getConfig(); $context->setConfig($config); $dbm = new \Aimeos\MW\DB\Manager\PDO($config); $context->setDatabaseManager($dbm); $fs = new \Aimeos\MW\Filesystem\Manager\Laravel(app('filesystem'), $config, storage_path('aimeos')); $context->setFilesystemManager($fs); $mail = new \Aimeos\MW\Mail\Swift(function () { return app('mailer')->getSwiftMailer(); }); $context->setMail($mail); $logger = \Aimeos\MAdmin\Log\Manager\Factory::createManager($context); $context->setLogger($logger); $cache = new \Aimeos\MAdmin\Cache\Proxy\Standard($context); $context->setCache($cache); self::$context = $context; } $context = self::$context; if ($locale === true) { $localeItem = $this->getLocale($context); $langid = $localeItem->getLanguageId(); $context->setLocale($localeItem); $context->setI18n(app('\\Aimeos\\Shop\\Base\\I18n')->get(array($langid))); } $session = new \Aimeos\MW\Session\Laravel5($this->session); $context->setSession($session); $this->addUser($context); return $context; }
/** * Returns the current context. * * @param \TYPO3\Flow\Mvc\RequestInterface $request Request object * @return \MShop_Context_Item_Interface */ public function get(\TYPO3\Flow\Mvc\RequestInterface $request = null) { if (self::$context === null) { $context = new \MShop_Context_Item_Default(); $config = $this->getConfig(); $context->setConfig($config); $dbm = new \MW_DB_Manager_PDO($config); $context->setDatabaseManager($dbm); $mail = new \MW_Mail_Swift($this->mailer); $context->setMail($mail); $logger = \MAdmin_Log_Manager_Factory::createManager($context); $context->setLogger($logger); $cache = $this->getCache($context); $context->setCache($cache); self::$context = $context; } $context = self::$context; if ($request !== null) { $localeItem = $this->getLocale($context, $request); $context->setLocale($localeItem); $i18n = $this->i18n->get(array($localeItem->getLanguageId())); $context->setI18n($i18n); } $session = new \MW_Session_Flow($this->session); $context->setSession($session); $this->addUser($context); return $context; }
/** * Returns the current context * * @param boolean $locale True to add locale object to context, false if not * @return \MShop_Context_Item_Interface Context object */ public function get($locale = true) { if (self::$context === null) { $context = new \MShop_Context_Item_Default(); $config = $this->getConfig(); $context->setConfig($config); $dbm = new \MW_DB_Manager_PDO($config); $context->setDatabaseManager($dbm); $mail = new \MW_Mail_Swift(function () { return app('mailer')->getSwiftMailer(); }); $context->setMail($mail); $logger = \MAdmin_Log_Manager_Factory::createManager($context); $context->setLogger($logger); $cache = new \MAdmin_Cache_Proxy_Default($context); $context->setCache($cache); self::$context = $context; } $context = self::$context; if ($locale === true) { $localeItem = $this->getLocale($context); $langid = $localeItem->getLanguageId(); $context->setLocale($localeItem); $context->setI18n(app('\\Aimeos\\Shop\\Base\\I18n')->get(array($langid))); } $session = new \MW_Session_Laravel4($this->session); $context->setSession($session); $this->addUser($context); return $context; }
/** * 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; }