AldeaRepository.php 1.02 KB
<?php

namespace UBV\SurUbvBundle\Entity;

use Doctrine\ORM\Query\Expr\Join;
use Doctrine\ORM\EntityRepository;

use Doctrine\ORM\Query;

/**
 * AldeaRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class AldeaRepository extends EntityRepository
{
  public function findAldeaByParroquiaId($parroquia_id)
  {
     $em = $this->getEntityManager();
     
     //die(dump($pais_id));
     $result = $em->createQueryBuilder();
     
     $dql = $result -> select ('aldea')
                    ->from('UBVSurUbvBundle:Aldea', 'aldea')
                    ->Join('aldea.ambiente', 'ambiente', 'ambiente.id = aldea.ambiente_id')
                    ->Join('ambiente.parroquia', 'parroquia', 'parroquia.id = ambiente.parroquia_id')
                    ->where('parroquia.id = :parroquia_id')
                    ->setParameter('parroquia_id',$parroquia_id)
                    ->getQuery()
                    ->getResult(Query::HYDRATE_ARRAY);
                    return $dql;
  }
}