protected function setTemplateParams() { $entitiesParams = $this->container->getParameter('skcms_admin.entities'); // $entityParams = $entitiesParams['Page']; $em = $this->getSKManager(); $repo = $this->getDoctrine()->getManager()->getRepository('SKCMS\\CoreBundle\\Entity\\Translation\\EntityTranslation'); // $page = $repo->findAllTranslations('slug',$slug,$entityParams['class']); $translationEntity = $repo->findObjectBySlug($this->slug, $this->locale); if (null == $translationEntity) { throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException('entity doesn\'t exists'); } $entityClass = $translationEntity->getObjectClass(); $repo = $em->getRepository('\\' . $entityClass); $this->entity = $repo->find($translationEntity->getForeignKey(), $this->locale); $this->templateParams['entity'] = $this->entity; if ($this->entity instanceof \SKCMS\ShopBundle\Entity\SKBaseProduct) { $productUtils = $this->get('skcms_shop.productutils'); $productForm = $productUtils->getProductForm($this->entity); $this->addTemplateParam('shopForm', $productForm); } parent::setTemplateParams(); }
protected function setTemplateParams() { $slugUtils = $this->get('skcms_core.slugutils'); $page = $slugUtils->getPageBySlug($this->slug, $this->locale); $this->templateParams['page'] = $page; $this->page = $this->templateParams['page']; if ($page === null) { return; } $listUtils = $this->get('skcms_core.listsutils'); $this->templateParams['lists'] = $listUtils->getPageList($this->page); $this->addTemplateParam('currentPage', $this->pageNumber); $modulesConfig = $this->getParameter('skcms_admin.modules'); if ($modulesConfig['contact']['enabled']) { $contact = $this->get('skcms.contact.form'); $contactForm = $contact->get(); if ($contactForm instanceof \Symfony\Component\HttpFoundation\RedirectResponse) { $this->forceResponse = $contactForm; } else { $this->addTemplateParam('contactForm', $contactForm); } } parent::setTemplateParams(); }