コード例 #1
0
ファイル: Shop.php プロジェクト: ClaudioThomas/shopware-4
 /**
  * @param \Enlight_Bootstrap $bootstrap
  * @deprecated
  * @return Shop
  */
 public function registerResources(\Enlight_Bootstrap $bootstrap)
 {
     $bootstrap->registerResource('Shop', $this);
     /** @var $locale \Zend_Locale */
     $locale = $bootstrap->getResource('Locale');
     $locale->setLocale($this->getLocale()->toString());
     /** @var $currency \Zend_Currency */
     $currency = $bootstrap->getResource('Currency');
     $currency->setLocale($locale);
     $currency->setFormat($this->getCurrency()->toArray());
     /** @var $config \Shopware_Components_Config */
     $config = $bootstrap->getResource('Config');
     $config->setShop($this);
     /** @var $snippets \Shopware_Components_Config */
     $snippets = $bootstrap->getResource('Snippets');
     $snippets->setShop($this);
     /** @var $snippets \Enlight_Plugin_PluginManager */
     $plugins = $bootstrap->getResource('Plugins');
     /** @var $pluginNamespace  \Shopware_Components_Plugin_Namespace */
     $pluginNamespace = null;
     foreach ($plugins as $pluginNamespace) {
         if ($pluginNamespace instanceof \Shopware_Components_Plugin_Namespace) {
             $pluginNamespace->setShop($this);
         }
     }
     if ($this->getTemplate() !== null) {
         /** @var $template \Enlight_Template_Manager */
         $templateManager = $bootstrap->getResource('Template');
         $template = $this->getTemplate();
         $localeName = $this->getLocale()->toString();
         if ($template->getVersion() == 2) {
             $templateManager->addTemplateDir(array('custom' => $template->toString(), 'local' => '_emotion_local', 'emotion' => '_emotion'));
         } else {
             $templateManager->addTemplateDir(array('custom' => $template->toString(), 'local' => '_local', 'emotion' => '_default'));
         }
         $templateManager->setCompileId('frontend' . '_' . $template->toString() . '_' . $localeName . '_' . $this->getId());
     }
     /** @var $templateMail \Shopware_Components_TemplateMail */
     $templateMail = $bootstrap->getResource('TemplateMail');
     $templateMail->setShop($this);
     return $this;
 }
コード例 #2
0
ファイル: Shop.php プロジェクト: GerDner/luck-docker
 /**
  * @param \Enlight_Bootstrap $bootstrap
  * @return Shop
  */
 public function registerResources(\Enlight_Bootstrap $bootstrap)
 {
     $bootstrap->registerResource('Shop', $this);
     /** @var $locale \Zend_Locale */
     $locale = $bootstrap->getResource('Locale');
     $locale->setLocale($this->getLocale()->toString());
     /** @var $currency \Zend_Currency */
     $currency = $bootstrap->getResource('Currency');
     $currency->setLocale($locale);
     $currency->setFormat($this->getCurrency()->toArray());
     /** @var $config \Shopware_Components_Config */
     $config = $bootstrap->getResource('Config');
     $config->setShop($this);
     /** @var $snippets \Shopware_Components_Config */
     $snippets = $bootstrap->getResource('Snippets');
     $snippets->setShop($this);
     /** @var $snippets \Enlight_Plugin_PluginManager */
     $plugins = $bootstrap->getResource('Plugins');
     /** @var $pluginNamespace  \Shopware_Components_Plugin_Namespace */
     $pluginNamespace = null;
     foreach ($plugins as $pluginNamespace) {
         if ($pluginNamespace instanceof \Shopware_Components_Plugin_Namespace) {
             $pluginNamespace->setShop($this);
         }
     }
     Shopware()->Container()->get('shopware_storefront.context_service')->initializeShopContext();
     if ($this->getTemplate() !== null) {
         /** @var $templateManager \Enlight_Template_Manager */
         $templateManager = $bootstrap->getResource('Template');
         $template = $this->getTemplate();
         $localeName = $this->getLocale()->toString();
         if ($template->getVersion() == 3) {
             $this->registerTheme($template);
         } elseif ($template->getVersion() == 2) {
             $templateManager->addTemplateDir(array('custom' => $template->toString(), 'local' => '_emotion_local', 'emotion' => '_emotion', 'include_dir' => '.'));
         } else {
             throw new \Exception(sprintf('Tried to load unsupported template version %s for template: %s', $template->getVersion(), $template->getName()));
         }
         $templateManager->setCompileId('frontend' . '_' . $template->toString() . '_' . $localeName . '_' . $this->getId());
     }
     /** @var $templateMail \Shopware_Components_TemplateMail */
     $templateMail = $bootstrap->getResource('TemplateMail');
     $templateMail->setShop($this);
     return $this;
 }