Example #1
0
 public function onPostDispatchFrontend(\Enlight_Event_EventArgs $args)
 {
     /** @var \Enlight_Controller_Action $controller */
     $controller = $args->getSubject();
     if (strtolower($controller->Request()->getControllerName()) == 'profiler') {
         return;
     }
     $profileId = uniqid();
     $view = $controller->View();
     $view->addTemplateDir($this->container->getParameter('shyim_profiler.plugin_dir') . '/Resources/views');
     $view->assign('sProfilerID', $profileId);
     $this->container->get('shyim_profiler.smarty_extensions')->addPlugins($view->Engine());
     $this->container->set('profileId', $profileId);
     $this->container->set('profileController', $controller);
 }
Example #2
0
 /**
  * Initializes the service container.
  *
  * The cached version of the service container is used when fresh, otherwise the
  * container is built.
  */
 protected function initializeContainer()
 {
     $class = $this->getContainerClass();
     $cache = new ConfigCache($this->config['hook']['proxyDir'] . '/' . $class . '.php', true);
     if (!$cache->isFresh()) {
         $container = $this->buildContainer();
         $container->compile();
         $this->dumpContainer($cache, $container, $class, 'Shopware\\Components\\DependencyInjection\\Container');
     }
     require_once $cache->getPath();
     $this->container = new $class();
     $this->container->set('kernel', $this);
 }
Example #3
0
 /**
  * Adds the given resource to the internal resource list and sets the STATUS_ASSIGNED status.
  * The given name will be used as identifier.
  *
  * @param string $name
  * @param mixed $resource
  * @return Enlight_Bootstrap
  */
 public function registerResource($name, $resource)
 {
     $this->container->set($name, $resource);
     return $this;
 }
 public function registerProductNumberSearch()
 {
     $this->container->set('shopware_search.product_number_search', $this->container->get('shopware_search_es.product_number_search'));
 }
Example #5
-1
 /**
  * @param Container $container
  * @return \Enlight_Components_Session_Namespace
  */
 public function factory(Container $container)
 {
     $sessionOptions = Shopware()->getOption('session', array());
     if (!empty($sessionOptions['unitTestEnabled'])) {
         \Enlight_Components_Session::$_unitTestEnabled = true;
     }
     unset($sessionOptions['unitTestEnabled']);
     if (\Enlight_Components_Session::isStarted()) {
         \Enlight_Components_Session::writeClose();
     }
     /** @var $shop \Shopware\Models\Shop\Shop */
     $shop = $container->get('Shop');
     $name = 'session-' . $shop->getId();
     $sessionOptions['name'] = $name;
     if (!isset($sessionOptions['save_handler']) || $sessionOptions['save_handler'] == 'db') {
         $config_save_handler = array('db' => $container->get('Db'), 'name' => 's_core_sessions', 'primary' => 'id', 'modifiedColumn' => 'modified', 'dataColumn' => 'data', 'lifetimeColumn' => 'expiry');
         \Enlight_Components_Session::setSaveHandler(new \Enlight_Components_Session_SaveHandler_DbTable($config_save_handler));
         unset($sessionOptions['save_handler']);
     }
     \Enlight_Components_Session::start($sessionOptions);
     $container->set('SessionID', \Enlight_Components_Session::getId());
     $namespace = new \Enlight_Components_Session_Namespace('Shopware');
     $namespace->offsetSet('sessionId', \Enlight_Components_Session::getId());
     return $namespace;
 }