src/PN/Bundle/HomeBundle/Controller/ServiceController.php
/**
     * Lists and show all Services entities.
     *
     * @Route("/{slug}", name="fe_service_show", methods={"GET"})
     */
Lists and show all Services entities.
Lists and show all Services entities .
public function showAction(Request $request, $slug) {
        $em = $this->getDoctrine()->getManager();
        $service = $this->get("fe_seo")->getSlug($request, $slug, new Service());
        if ($service instanceof RedirectResponse) {
            return $service;
        }
        if (!$service) {
            throw $this->createNotFoundException();
        }
        $projectsIdsUsingService = $em->getRepository(Service::class)->getProjectsIdsUsingService($service);
        $projectsUsingService = [];
        if(!empty($projectsIdsUsingService)) {
            $projectsUsingService = $this->getProjectsUsingService($projectsIdsUsingService);
        }
        return $this->render('home/service/show.html.twig', [
            'service' => $service,
            'relatedServices' => $this->getRelatedServices($service),
            'projectUsingTheService' => $projectsUsingService,
        ]);
    }
public function showAction ( Request $ request , $ slug ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ service = $ this -> get ( " fe_seo " ) -> getSlug ( $ request , $ slug , new Service ( ) ) ; if ( $ service instanceof RedirectResponse ) { return $ service ; } if ( ! $ service ) { throw $ this -> createNotFoundException ( ) ; } $ projectsIdsUsingService = $ em -> getRepository ( Service :: class ) -> getProjectsIdsUsingService ( $ service ) ; $ projectsUsingService = [ ] ; if ( ! empty ( $ projectsIdsUsingService ) ) { $ projectsUsingService = $ this -> getProjectsUsingService ( $ projectsIdsUsingService ) ; } return $ this -> render ( 'home/service/show.html.twig' , [ 'service' => $ service , 'relatedServices' => $ this -> getRelatedServices ( $ service ) , 'projectUsingTheService' => $ projectsUsingService , ] ) ; }
Lists and show all Services entities.
Lists and show all Services entities .