I have a following dql in my repostory class:
public function find2($id)
{
return $this->createQueryBuilder('b')
->select('b', 'branch', 'pai', 'dri', 'COUNT(dri) AS ct')
->leftJoin('b.branches', 'branch')
->leftJoin('branch.productAllocationItems','pai')
->leftJoin('pai.DRItems', 'dri')
->where('b.id = :id')
->setParameter('id', $id)
->andWhere('ct > 1')
->getQuery()
->getResult();
}
My problem is COUNT doesnt seem to work, is there any wrong in my query? I just want to return entity whose DRItems based on the condition. Thanks.
I got the following error:
Column not found: 1054 Unknown column 'sclr0' in 'where clause'