I would like to search for people who are not allocated to a room. I made the following query:
public function findByWithoutRoom()
{
    $qb = $this->getEntityManager()->createQueryBuilder();
    $qb2 = $this->getEntityManager()->createQueryBuilder();
    $qb
        ->select('p')
        ->from('MyPeopleBundle:Person', 'p')
        ->where(
            $qb->expr()->exists(
                $qb2->select('r')
                    ->from('MyAccommodationBundle:Room', 'r')
                    ->andWhere($qb2->expr()->like('r.currentPeople', ':person'))
                    ->setParameter('person', '%i:'.$person_id.';%')
                    ->getDQL()
            )
        )
    $result = $qb->getQuery()->execute();
    return $result;
}
How can I have p.id instead of person_id? Note:The currentPeople property is of type "array" (not "simple_array")
UPDATE:
I also tried the following:
public function finByWithoutRoom()
{
    $qb = $this->getEntityManager()->createQueryBuilder();
    $qb
        ->select('p')
        ->from('MyPeopleBundle:Person', 'p')
        ->leftJoin('MyAccommodationBundleV2:Room', 'r')
        ->andWhere($qb->expr()->like('r.currentPeople', '%i:p.id%'));
    $result = $qb->getQuery()->execute();
    return $result;
}
however this gave me the following error:
[Syntax Error] line 0, col 114: Error: Expected StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression, got '%'