コード例 #1
0
 /**
  * @param   array $criteria
  * @return  object|\Shopware\Models\Menu\Menu
  */
 public function findOneBy(array $criteria)
 {
     if (func_num_args() === 2) {
         return parent::findOneBy(array(func_get_arg(0) => func_get_arg(1)));
     } else {
         return parent::findOneBy($criteria);
     }
 }
コード例 #2
0
ファイル: Installer.php プロジェクト: GerDner/luck-docker
 /**
  * Helper function which resolves the theme parent for each
  * passed theme
  *
  * @param array $themes
  * @throws \Exception
  */
 private function setParents(array $themes)
 {
     /**@var $theme Theme */
     foreach ($themes as $theme) {
         if ($theme->getExtend() === null) {
             continue;
         }
         $template = $this->repository->findOneBy(array('template' => $theme->getTemplate()));
         $parent = $this->repository->findOneBy(array('template' => $theme->getExtend()));
         if (!$parent instanceof Shop\Template) {
             throw new \Exception(sprintf("Parent %s of theme %s not found", $theme->getExtend(), $theme->getTemplate()));
         }
         $template->setParent($parent);
         $this->entityManager->flush();
     }
 }
コード例 #3
0
ファイル: Configurator.php プロジェクト: GerDner/luck-docker
 /**
  * This function handles the configuration inheritance for the synchronization.
  * The function handles the inheritance over a recursive call.
  *
  * First this function is called with the theme which should be synchronized.
  * If the theme uses a inheritance configuration, the
  * function resolves the theme parent and calls the "createConfig" function
  * of the Theme.php.
  * The Form\Container\TabContainer won't be initialed again, so each
  * inheritance level becomes the same container instance passed into their
  * createConfig() function.
  *
  * This allows the developer to display the theme configuration of extened
  * themes.
  *
  * @param Theme $theme
  * @param Form\Container\TabContainer $container
  * @return Form\Container\TabContainer
  */
 private function injectConfig(Theme $theme, Form\Container\TabContainer $container)
 {
     //check if theme wants to inject parent configuration
     if (!$theme->useInheritanceConfig() || $theme->getExtend() == null) {
         return;
     }
     /**@var $template Shop\Template */
     $template = $this->repository->findOneBy(array('template' => $theme->getTemplate()));
     //no parent configured? cancel injection.
     if (!$template->getParent()) {
         return;
     }
     //get Theme.php instance of the parent template
     $parent = $this->util->getThemeByTemplate($template->getParent());
     $this->injectConfig($parent, $container);
     $parent->createConfig($container);
 }