Commit 2dea371f authored by Mat's avatar Mat
Browse files

query builder inutilisé, avec INNER JOIN

parent 96301ecb
......@@ -53,4 +53,26 @@ class MembreRepository extends \Doctrine\ORM\EntityRepository
return $qb->getQuery()->getOneOrNullResult();
}
/**
* @param $id
* @return Array
*/
public function countMembresByAsso($id)
{
// Cette fonction ne sert finalement pas.
// Je la laisse pour l'exemple DQL avec INNER JOIN
// SELECT COUNT(m.association_id) FROM membre m
// INNER JOIN association a ON m.association_id = a.id
// WHERE a.id = 1
$qb = $this->createQueryBuilder('m')
->select('COUNT(m.association)')
->innerJoin('m.association', 'a', 'WITH', 'a.id = m.association' )
->where('a.id = :id')
->setParameter(':id', $id);
return $qb->getQuery()->getSingleResult();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment