public function getResultByFilters($filters = array(), $hydrationMode = Query::HYDRATE_OBJECT) { $qb = $this->_em->createQueryBuilder(); $qb->select('tr, sp, subSp')->from('TreatmentBundle:Treatment', 'tr')->innerJoin('tr.specialization', 'sp')->leftJoin('tr.subSpecializations', 'subSp')->where('1=1'); $knownFilters = array('specialization' => $qb->expr()->eq('tr.specialization', ':specialization'), 'subSpecialization' => $qb->expr()->eq('subSp.id', ':subSpecialization'), 'status' => $qb->expr()->eq('tr.status', ':status')); $qb = QueryHelper::applyQueryBuilderFilters($qb, $knownFilters, $filters); $qb->orderBy('tr.name', 'ASC'); return $qb->getQuery()->getResult($hydrationMode); }
public function getResultByFilters(array $filters = array(), $hydrationMode = Query::HYDRATE_ARRAY) { $qb = $this->_em->createQueryBuilder(); $qb->select('inst_sp, inst, imc, sp')->from('InstitutionBundle:InstitutionSpecialization', 'inst_sp')->innerJoin('inst_sp.institutionMedicalCenter', 'imc')->innerJoin('imc.institution', 'inst')->innerJoin('inst_sp.specialization', 'sp')->where('1=1'); $knownFilters = array('specialization' => $qb->expr()->eq('inst_sp.specialization', ':specialization')); $qb = QueryHelper::applyQueryBuilderFilters($qb, $knownFilters, $filters); $qb->orderBy('inst.name', 'ASC'); return $qb->getQuery()->getResult($hydrationMode); }