예제 #1
0
 /**
  * Creates a filtered query builder.
  *
  * @param FormInterface $form Filter form
  *
  * @return QueryBuilder Returns the queryBuilder object to filter on
  */
 private function createQueryBuilder(FormInterface $form)
 {
     $qb = $this->manager->getQueryBuilder();
     if ($form->isValid()) {
         $this->filterBuilderUpdater->addFilterConditions($form, $qb);
     }
     return $qb;
 }
 public function preparateSearchQueryData(Form $filter, FilterBuilderUpdater $builder)
 {
     $filterBuilder = $this->em->getRepository('AppBundle:Estudiante')->createQueryBuilder('e')->select('e, p')->leftJoin('e.clase', 'c')->leftJoin('e.horario', 'h')->leftJoin('e.progenitores', 'p');
     $filterBuilder->andWhere('e.egresado = false');
     $builder->addFilterConditions($filter, $filterBuilder);
     $queryData = $filterBuilder->getQuery()->getResult();
     $headers = array();
     $entities = array();
     foreach ($queryData as $data) {
         $auxData = array();
         $auxData['referenciaBancaria'] = $data->getCuenta()->getReferenciabancaria();
         $auxData['nombre'] = $data->getNombre();
         $auxData['apellido'] = $data->getApellido();
         $auxData['fechaNacimiento'] = $data->getFechaNacimiento();
         $auxData['anioIngreso'] = $data->getAnioIngreso();
         $auxData['sociedadMedica'] = '';
         if ($data->getSociedadMedica()) {
             $auxData['sociedadMedica'] = $data->getSociedadMedica()->getName();
         }
         $auxData['emergenciaMedica'] = '';
         if ($data->getEmergenciaMedica()) {
             $auxData['emergenciaMedica'] = $data->getEmergenciaMedica()->getName();
         }
         $auxData['horario'] = '';
         if ($data->getHorario()) {
             $auxData['horario'] = $data->getHorario()->getName();
         }
         $auxData['futuroColegio'] = '';
         if ($data->getFuturoColegio()) {
             $auxData['futuroColegio'] = $data->getFuturoColegio()->getName();
         }
         $auxData['clase'] = '';
         if ($data->getClase()) {
             $auxData['clase'] = $data->getClase()->getName();
         }
         $auxData['progenitor'] = '';
         $auxData['email'] = '';
         $auxData['direccion'] = '';
         $auxData['telefono'] = '';
         $auxData['celular'] = '';
         foreach ($data->getProgenitores() as $progenitor) {
             if ($auxData['email'] != '') {
                 $auxData['email'] = $auxData['email'] . ', ' . $progenitor->getEmail();
             } else {
                 $auxData['email'] = $progenitor->getEmail();
             }
             if ($auxData['progenitor'] != '' && $progenitor->getNombre() !== '') {
                 $auxData['progenitor'] = $auxData['progenitor'] . ', ' . $progenitor->getNombre();
             } else {
                 $auxData['progenitor'] = $auxData['progenitor'] . $progenitor->getNombre();
             }
             if ($auxData['direccion'] != '' && $progenitor->getDireccion() !== '') {
                 $auxData['direccion'] = $auxData['direccion'] . ', ' . $progenitor->getDireccion();
             } else {
                 $auxData['direccion'] = $auxData['direccion'] . $progenitor->getDireccion();
             }
             if ($auxData['telefono'] != '' && $progenitor->getTelefono() !== '') {
                 $auxData['telefono'] = $auxData['telefono'] . ', ' . $progenitor->getTelefono();
             } else {
                 $auxData['telefono'] = $auxData['telefono'] . $progenitor->getTelefono();
             }
             if ($auxData['celular'] != '' && $progenitor->getCelular() !== '') {
                 $auxData['celular'] = $auxData['celular'] . ', ' . $progenitor->getCelular();
             } else {
                 $auxData['celular'] = $auxData['celular'] . $progenitor->getCelular();
             }
         }
         $headers = array_keys($auxData);
         $entities[] = $auxData;
     }
     return array('headers' => $headers, 'entities' => $entities);
 }