public function exportAction()
    {
        $em = $this->getDoctrine()->getManager();
        $chillSecurityHelper = $this->get('chill.main.security.authorization.helper');
        $user = $this->get('security.context')->getToken()->getUser();

        $reachableCenters = $chillSecurityHelper->getReachableCenters($user,
            new Role('CHILL_PERSON_SEE'));

        $personRepository = $em->getRepository('ChillPersonBundle:Person');
        $qb = $personRepository->createQueryBuilder('p');
        $qb->where($qb->expr()->in('p.center', ':centers'))
            ->setParameter('centers', $reachableCenters);
        $persons = $qb->getQuery()->getResult();

        $response = $this->render('ChillPersonBundle:Person:export.csv.twig',
            array(
                'persons' => $persons,
                'cf_group' => $this->getCFGroup()));
        $response->headers->set('Content-Type', 'text/csv; charset=utf-8');
        $response->headers->set('Content-Disposition', 'attachment; filename="export_person.csv"');

        return $response;
    }
public function exportAction()
    {
        $em = $this->getDoctrine()->getManager();
        $chillSecurityHelper = $this->get('chill.main.security.authorization.helper');
        $user = $this->get('security.context')->getToken()->getUser();

        $reachableCenters = $chillSecurityHelper->getReachableCenters($user,
            new Role('CHILL_PERSON_SEE'));

        $personRepository = $em->getRepository('ChillPersonBundle:Person');
        $qb = $personRepository->createQueryBuilder('p');
        $qb->where($qb->expr()->in('p.center', ':centers'))
            ->setParameter('centers', $reachableCenters);
        $persons = $qb->getQuery()->getResult();

        $response = $this->render('ChillPersonBundle:Person:export.csv.twig',
            array(
                'persons' => $persons,
                'cf_group' => $this->getCFGroup()));
        $response->headers->set('Content-Type', 'text/csv; charset=utf-8');
        $response->headers->set('Content-Disposition', 'attachment; filename="export_person.csv"');

        return $response;
    }
public function exportAction ( ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ chillSecurityHelper = $ this -> get ( 'chill.main.security.authorization.helper' ) ; $ user = $ this -> get ( 'security.context' ) -> getToken ( ) -> getUser ( ) ; $ reachableCenters = $ chillSecurityHelper -> getReachableCenters ( $ user , new Role ( 'CHILL_PERSON_SEE' ) ) ; $ personRepository = $ em -> getRepository ( 'ChillPersonBundle:Person' ) ; $ qb = $ personRepository -> createQueryBuilder ( 'p' ) ; $ qb -> where ( $ qb -> expr ( ) -> in ( 'p.center' , ':centers' ) ) -> setParameter ( 'centers' , $ reachableCenters ) ; $ persons = $ qb -> getQuery ( ) -> getResult ( ) ; $ response = $ this -> render ( 'ChillPersonBundle:Person:export.csv.twig' , array ( 'persons' => $ persons , 'cf_group' => $ this -> getCFGroup ( ) ) ) ; $ response -> headers -> set ( 'Content-Type' , 'text/csv; charset=utf-8' ) ; $ response -> headers -> set ( 'Content-Disposition' , 'attachment; filename="export_person.csv"' ) ; return $ response ; }
Return a csv file with all the persons

@return A csv file with all the persons
Return a csv file with all the persons