/**
  * {@inheritDoc}
  */
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }
Beispiel #2
0
 /**
  * Returns the configuration sets for the passed template.
  * This function returns additionally the inheritance
  * configuration sets of the passed template.
  * The sets are translated automatically.
  *
  * @param Shop\Template $template
  * @return array
  */
 public function getConfigSets(Shop\Template $template)
 {
     $builder = $this->entityManager->createQueryBuilder();
     $builder->select(array('template', 'sets'))->from('Shopware\\Models\\Shop\\Template', 'template')->innerJoin('template.configSets', 'sets')->where('sets.templateId = :templateId')->orderBy('sets.name')->setParameter('templateId', $template->getId());
     $themes = $builder->getQuery()->getArrayResult();
     $namespace = $this->getConfigSnippetNamespace($template);
     $namespace->read();
     foreach ($themes as &$theme) {
         $theme = $this->translateThemeData($theme, $namespace);
         foreach ($theme['configSets'] as &$set) {
             $set = $this->translateConfigSet($set, $namespace);
         }
     }
     $instance = $this->util->getThemeByTemplate($template);
     if ($template->getParent() instanceof Shop\Template && $instance->useInheritanceConfig()) {
         $themes = array_merge($themes, $this->getConfigSets($template->getParent()));
     }
     return $themes;
 }
Beispiel #3
0
 /**
  * Returns all config elements of the passed template.
  *
  * @param \Shopware\Models\Shop\Template $template
  * @return ArrayCollection
  */
 private function getElements(Shop\Template $template)
 {
     $builder = $this->entityManager->createQueryBuilder();
     $builder->select('elements')->from('Shopware\\Models\\Shop\\TemplateConfig\\Element', 'elements')->where('elements.templateId = :templateId')->setParameter('templateId', $template->getId());
     $elements = $builder->getQuery()->getResult();
     $elements = $this->eventManager->filter('Theme_Configurator_Elements_Loaded', $elements, array('template' => $template));
     return new ArrayCollection($elements);
 }