I have the following query which is working however at the moment it is returning all the rows in the pupils table rather than just the ones that link to the ClassGroupPupils table and have a group id as specified.
Am I missing something basic when creating a join query?
**still new to Symfony*
$query = $this->getDoctrine()->getRepository('AppBundle:Pupils')->createQueryBuilder('p')
->join('AppBundle:ClassGroupPupils','cgp')
->where('cgp.group = :group_id')
->andWhere('p.active = 1')
->setParameter('group_id',$group->getId())->getQuery()->getResult();
If cpg.group
is a mapped relation, you should try ->setParameter('group_id',$group)