public function showAction(CategoryService $categoryService) { parent::initFrontEnd(); $rep_img = $this->getDoctrine()->getManager()->getRepository('WellnessCoreBundle:Image'); $CurrentLogoCategory = $rep_img->findOneBy(array('categoryService' => $categoryService->getId())); if ($CurrentLogoCategory == null) { throw $this->createNotFoundException("Pas de logo categorie trouvé !"); } return $this->render('WellnessCoreBundle:FrontEnd/Category:show.html.twig', array('listCategoryWithLogo' => $this->getListCategoryWithLogo(), 'listImagesSlider' => $this->getListImageSlider(), 'CurrentLogoCategory' => $CurrentLogoCategory)); }
public function load(ObjectManager $manager) { $tab_Categ = array(array("name" => "Solarium", "description" => "Tous les soins concernant les solariums", "forward" => "1", "validated" => "0"), array("name" => "Pedicure", "description" => "Tous les soins des pieds", "forward" => "0", "validated" => "0"), array("name" => "Epilation", "description" => "Enlevez vos poils", "forward" => "0", "validated" => "0"), array("name" => "Sauna", "description" => "bain de chaleur sèche qui peut varier de 70 °C à 100 °C, pour le bien-être. La pratique du sauna est une tradition sociale et familiale qui semble exister depuis plus de 2 000 ans dans les pays nordiques, notamment en Finlande", "forward" => "0", "validated" => "0"), array("name" => "Hammam", "description" => "La définition du hammam est simple : c'est un bain de vapeur chaude et humide. La température de la vapeur atteint environ 50 °C.\nLe taux d'humidité est de 100 %, ce qui rend la chaleur tout à fait supportable", "forward" => "0", "validated" => "0")); for ($i = 0; $i < sizeof($tab_Categ); $i++) { $categservice = new CategoryService(); $categservice->setName($tab_Categ[$i]['name']); $categservice->setDescription($tab_Categ[$i]['description']); $categservice->setForward($tab_Categ[$i]['forward']); $categservice->setValidated($tab_Categ[$i]['validated']); $manager->persist($categservice); } $manager->flush(); }
public function deleteAction(Request $request, CategoryService $categoryService) { $form = $this->createDeleteForm($categoryService->getId()); $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('WellnessCoreBundle:CategoryService')->find($categoryService->getId()); if (!$entity) { throw $this->createNotFoundException('Unable to find CategoryService entity.'); } $em->remove($entity); $em->flush(); } return $this->redirect($this->generateUrl('admin_categoryservice')); }