-1

I've a function and i would like put my attributes to lower :

public function getHomonymes($nom, $prenom)
{
    $queryBuilder = $this->createQueryBuilder("u")
    ->select("count(u.id")
    ->where("lower(u.nom) = :nom")
    ->andWhere("lower(u.prenom) = :prenom")
    ->setParameter("nom",strtolower($nom))
    ->setParameter("prenom",strtolower($prenom));
    return $queryBuilder->getQuery()->getSingleScalarResult();
}

But it doesn't work. I get:

[Syntax Error] line 0, col 52: Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got 'u'

Thanks for your help!

Haley Mueller
  • 487
  • 4
  • 16
Agar io FR
  • 53
  • 13
  • You don't have table from condition in your query => select FROM where. Your createQueryBuilder() seems to doesn't know the name of the table. – Shim-Sao Mar 27 '19 at 15:52

1 Answers1

2

You forgot a closing parenthesis in your select statement

->select("count(u.id")

should be

->select("count(u.id)")
Yoann MIR
  • 811
  • 5
  • 17