JOIN error with Symfony

0

I have a relationship between 2 Orders and Users tables from the field user_id and id respectively.

I make this query:

$dql="SELECT u, o
      FROM BackendBundle:Orders o
      JOIN o.users u";
$query=$em->createQuery($dql);

And this is the error that shows me:

  

[Semantical Error] line 0, col 68 near 'u': Error: Class BackendBundle \ Entity \ Orders has no association named users

And I do not know how I can correct this error.

    
asked by juanitourquiza 02.08.2017 в 05:30
source

1 answer

0

Performing more tests I found the solution. It was just to put user and not plural users . The query looks like this:

$dql="SELECT u, o
      FROM BackendBundle:Orders o
      JOIN o.user u";
$query=$em->createQuery($dql);
    
answered by 02.08.2017 в 05:45