Doctrine query builder : semantical error
10,741
Problem solved, the good query is :
$query = $em->createQuery( 'SELECT DISTINCT a.type_bien FROM APNegociationBundle:Annonce a' );
Related videos on Youtube
Author by
Jérémy Dutheil
Freelance web developer (HTML5, CSS3, PHP and frameworks) http://www.jeremy-dutheil.fr
Updated on June 04, 2022Comments
-
Jérémy Dutheil almost 2 years
I have a table named "Annonce" that contains some informations about a post ; I would like to retrieve all the "type_bien" (it's a field) already registered in the database by a query. My table has the good field "type_bien", my Entity also.
So I tryed :
$em = $this->get('doctrine')->getEntityManager(); $query = $em->createQuery( 'SELECT DISTINCT type_bien FROM APNegociationBundle:Annonce' );
But I got a semantical error :
[Semantical Error] line 0, col 16 near 'type_bien FROM': Error: 'type_bien' is not defined.
Is there something wrong with my query ?