trying to get liked statuses by user.
public function getLikedStatuses(User $user)
{
$qb = $this->_em->createQueryBuilder();
$qb
->select('s.id')
->from('WallBundle:Likes','l')
->innerJoin('l.status', 's')
->where('l.user = :user')
->setParameter('user', $user)
->orderBy('s.id','DESC')
;
$qb2= $this->_em->createQueryBuilder()
->select('st')
->from('WallBundle:Status','st');
$qb2 ->andWhere($qb2->expr()->in('st.id',$qb->getDQL()));
return $qb2->getQuery()->getResult();
}
Error: Invalid parameter number: number of bound variables does not match number of tokens
BTW: when i dump the $qb->getDQL():
string 'SELECT s.id FROM TB\WBundle\Entity\Likes l LEFT JOIN l.status s WHERE l.user = :user' (length=87)
BTW2: when i replace the '$qb->getDQL()' for (12073) (id of status) it works...
$qbingetLikedStatusesFinal()?var_dumpof$qb2->getDQL()?setParameter()on the second query or try doinggetQuery()on$qdbefore putting it in the second one. Seems like doctrine thinks the parameters should be on the second query.