Is there a way to use a Doctrine reserved word in a DQL statement?

132 Views Asked by At

Is there a way to use a Doctrine reserved word in a DQL statement?

I would like to use an Entity class called "Member" but I cannot use it neither with QueryBuilder nor Query, aliases, etc.

Examples :

$qb = $entityManager->createQueryBuilder();
$qb->select('m.id')
  ->from('Member', 'm')
  ->where('m.id=1234');
return $qb->getQuery()->getArrayResult();

or

$q = $entityManager->createQuery('select m.id from Member m');
return $q->getArrayResult();

both examples give the following error:

Error: Expected Doctrine\ORM\Query\Lexer::T_ALIASED_NAME, got 'Member'

Note : the table name is not the problem since it's not Member

0

There are 0 best solutions below