public function load(ObjectManager $manager) { $service1 = new Service(); $service1->setName('Electrical'); $service1->setAlias('electrical'); $service1->setIsPrimary(true); $service1->setEnabled(true); $manager->persist($service1); $service2 = new Service(); $service2->setName('Metal'); $service2->setAlias('metalwork'); $service2->setIsPrimary(true); $service2->setEnabled(true); $manager->persist($service2); $service3 = new Service(); $service3->setName('Lifts'); $service3->setAlias('elevator'); $service3->setIsPrimary(true); $service3->setEnabled(true); $manager->persist($service3); $service4 = new Service(); $service4->setName('Ventilated facade'); $service4->setAlias('facade'); $service4->setIsPrimary(true); $service4->setEnabled(true); $manager->persist($service4); $service5 = new Service(); $service5->setName('Electrical laboratory'); $service5->setAlias('laboratory'); $service5->setIsPrimary(true); $service5->setEnabled(true); $manager->persist($service5); $service6 = new Service(); $service6->setName('Estimates and agreements'); $service6->setAlias('estimate'); $service6->setIsPrimary(true); $service6->setEnabled(true); $manager->persist($service6); $manager->flush(); $this->addReference('service-electrical', $service1); $this->addReference('service-metalwork', $service2); $this->addReference('service-elevator', $service3); $this->addReference('service-facade', $service4); $this->addReference('service-laboratory', $service5); $this->addReference('service-estimate', $service6); }
/** * Translate Service preview by current Language on Index page * * @return Response * * @param $id * @param $locale * @param Service $service * @ParamConverter("service", * class="SonetAppBundle:Service", * options={"id" = "id"} * ) * @Method("GET") */ public function translateServicePreviewAction($id, $locale, Service $service) { $cLocale = $this->get('like_container')->currentLocale(); $cLanguage = $this->get('entity')->languages()->getLanguageByLocale($locale); $defLocale = $this->container->getParameter('locale'); $defLanguage = $this->get('entity')->languages()->getLanguageByLocale($defLocale); $content = $service->getDisplayedContent($cLanguage, $defLanguage); return $this->render("@SonetApp/blocks/service/translatedContent.html.twig", array('currentLocale' => $cLocale, 'service' => $service, 'content' => $content)); }