public function getServiceCategoriesAllNgAction()
 {
     $em = $this->getDoctrine()->getManager();
     $response = new Response(json_encode(array("result" => ServiceCategory::getAllServiceCategories($em, true))));
     $response->headers->set('Content-Type', 'application/json');
     return $response;
 }
Ejemplo n.º 2
0
 public static function getServicesCalculator($em)
 {
     $result = array();
     $categories = ServiceCategory::getAllServiceCategories($em);
     foreach ($categories as $category) {
         $qb = $em->getRepository("RenovateMainBundle:Service")->createQueryBuilder('s')->select('s')->orderBy('s.created', 'DESC')->where("s.categoryid = :id")->setParameter("id", $category->getId());
         $services = $qb->getQuery()->getResult();
         $result[] = array('category' => $category->getName(), 'services' => array_map(function ($service) {
             return $service->getInArray();
         }, $services));
     }
     return $result;
 }