Aimeos\Shop\Base\Context::get PHP Method

get() public method

Returns the current context
public get ( boolean $locale = true, string $type = 'frontend' ) : Aimeos\MShop\Context\Item\Iface
$locale boolean True to add locale object to context, false if not (deprecated, use \Aimeos\Shop\Base\Locale)
$type string 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;
    }

Usage Example

Beispiel #1
0
 /**
  * Single entry point for all JSON admin requests.
  */
 public function doAction()
 {
     $context = $this->context->get($this->request);
     $context = $this->setLocale($context);
     $cntlPaths = $this->aimeos->get()->getCustomPaths('controller/extjs');
     $controller = new \Controller_ExtJS_JsonRpc($context, $cntlPaths);
     return $controller->process($this->request->getArguments(), 'php://input');
 }
All Usage Examples Of Aimeos\Shop\Base\Context::get