public function testClearSpecific() { $cache = \Aimeos\Admin\JsonAdm\Factory::setCache(true); $context = \TestHelperJadm::getContext(); $templatePaths = \TestHelperJadm::getJsonadmPaths(); $cntlA1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order'); $cntlB1 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base'); \Aimeos\Admin\JsonAdm\Factory::clear((string) $context, 'order'); $cntlA2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order'); $cntlB2 = \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, 'order/base'); \Aimeos\Admin\JsonAdm\Factory::setCache($cache); $this->assertNotSame($cntlA1, $cntlA2); $this->assertSame($cntlB1, $cntlB2); }
/** * Returns the JsonAdm client * * @return \Aimeos\Admin\JsonAdm\Iface JsonAdm client */ protected function createClient() { $site = Route::input('site', Input::get('site', 'default')); $lang = Input::get('lang', config('app.locale', 'en')); $resource = Route::input('resource'); $aimeos = app('\\Aimeos\\Shop\\Base\\Aimeos')->get(); $templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates'); $context = app('\\Aimeos\\Shop\\Base\\Context')->get(false, 'backend'); $context->setI18n(app('\\Aimeos\\Shop\\Base\\I18n')->get(array($lang, 'en'))); $context->setLocale(app('\\Aimeos\\Shop\\Base\\Locale')->getBackend($context, $site)); $context->setView(app('\\Aimeos\\Shop\\Base\\View')->create($context, $templatePaths, $lang)); return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); }
/** * Returns the resource client * * @param string Resource location, e.g. "product/stock/wareshouse" * @return \Aimeos\Admin\JsonAdm\Iface Jsonadm client */ protected function createClient($resource) { $templatePaths = Base::getAimeos()->getCustomPaths('admin/jsonadm/templates'); $context = $this->getContextBackend($templatePaths); return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); }
public static function bootstrap() { self::getAimeos(); \Aimeos\MShop\Factory::setCache(false); \Aimeos\Admin\JsonAdm\Factory::setCache(false); }
/** * Returns the resource controller * * @param ContainerInterface $container Dependency injection container * @param ServerRequestInterface $request Request object * @param ResponseInterface $response Response object * @param array $args Associative list of route parameters * @return \Aimeos\Controller\JsonAdm\Iface JSON admin controller */ protected static function createClient(ContainerInterface $container, ServerRequestInterface $request, ResponseInterface $response, array $args) { $resource = isset($args['resource']) ? $args['resource'] : null; $site = isset($args['site']) ? $args['site'] : 'default'; $lang = isset($args['lang']) ? $args['lang'] : 'en'; $templatePaths = $container->get('aimeos')->getCustomPaths('admin/jsonadm/templates'); $context = $container->get('aimeos_context')->get(false, $args, 'backend'); $context->setI18n($container->get('aimeos_i18n')->get(array($lang, 'en'))); $context->setLocale($container->get('aimeos_locale')->getBackend($context, $site)); $view = $container->get('aimeos_view')->create($context->getConfig(), $request, $response, $args, $templatePaths, $lang); $context->setView($view); return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); }
/** * Returns the resource controller * * @param string $site Unique site code * @param string Resource location, e.g. "product/stock/wareshouse" * @param string $lang Language code * @return \Aimeos\MShop\Context\Item\Iface Context item */ protected function createClient($site, $resource, $lang) { $aimeos = $this->get('aimeos')->get(); $templatePaths = $aimeos->getCustomPaths('admin/jsonadm/templates'); $context = $this->get('aimeos_context')->get(false, 'backend'); $context->setI18n($this->get('aimeos_i18n')->get(array($lang, 'en'))); $context->setLocale($this->get('aimeos_locale')->getBackend($context, $site)); $view = $this->get('aimeos_view')->create($context, $templatePaths, $lang); $context->setView($view); return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); }
/** * Returns the resource controller * * @param string $sitecode Unique site code * @param string Resource location, e.g. "product/stock/wareshouse" * @param string $lang Language code * @return \Aimeos\Admin\JsonAdm\Iface JsonAdm client */ protected function createClient($sitecode, $resource, $lang) { $lang = $lang ? $lang : 'en'; $templatePaths = $this->aimeos->get()->getCustomPaths('admin/jsonadm/templates'); $context = $this->context->get(null, 'backend'); $context->setI18n($this->i18n->get(array($lang, 'en'))); $context->setLocale($this->locale->getBackend($context, $sitecode)); $context->setView($this->viewContainer->create($context, $this->uriBuilder, $templatePaths, $this->request, $lang)); return \Aimeos\Admin\JsonAdm\Factory::createClient($context, $templatePaths, $resource); }