I have an entity Image that is in a ManyToMany relation with a Tag entity. I am trying to get the images that are related to the Tag i am fetching from the database in an inner join request as shown bellow:
public function findOneByNameWithImages(string $name)
{
return $this->createQueryBuilder('t')
->addSelect('t.images')
->leftJoin('t.images', 'images')
->where('t.name = :name')
->setParameter('name', $name)
->getQuery()
->getResult();
}
But when i execute the query i get this error:
[Semantical Error] line 0, col 12 near 'images FROM App\Entity\Tag':
Error: Invalid PathExpression. Must be a StateFieldPathExpression.