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 ?
Problem solved, the good query is :
$query = $em->createQuery( 'SELECT DISTINCT a.type_bien FROM APNegociationBundle:Annonce a' );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With