I'm trying to create and action that returns all Variantset for a given PrivateUser. It's a many-to-many relationship, so there's a connection table in between.
This is the query I'm trying to run
$variants = $repository->createQuery('SELECT variants
FROM AppBundle:PrivUser user
JOIN AppBundle:PrivUserVariantset uv
JOIN AppBundle:Variantset variants
WHERE user.iduser=:user_id')
->setParameter('user_id', $userid)
->getResult();
but it returns:
[Syntax Error] line 0, col 146: Error: Expected =, <, <=, <>, >, >=, !=, got 'variants'
If I try the very same query with a single join, getting for instance the number of Variantsets from the PrivUserVariantset table, it does work. It looks like a syntax error, but I don't manage to find it from the examples I have gathered.
Is this the right way to do this query?