Symfony join with many to many <p>I would like to know how can I Make a join into another join.</p> <p>My QueryBuilder</p> <pre><code>return $this-&gt;createQueryBuilder("t") -&gt;leftjoin("t.playlist","p","WITH","p.genres=:genreP") -&gt;setParameter(":genreP",$genre) -&gt;addSelect("p") -&gt;getQuery() -&gt;getResult() ; </code></pre> <p>I had this error: [Semantical Error] line 0, col 170 near 'genres=:genreP': Error: Invalid PathExpression. StateFieldPathExpression or SingleValuedAssociationField expected.</p> <p>What I am trying to do:</p> <p>I have the <strong>Trending</strong> entity that has a relation OneToOne to the <strong>Playlist</strong> entity.The <strong>playlist</strong> entity has a relation ManyToMany to the <strong>Genre</strong> entity.</p> <p>The trending entity:</p> <pre><code>class Trending { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** *@ORM\OneToOne(targetEntity="Song", inversedBy="trending") */ private $song; /** *@ORM\OneToOne(targetEntity="Album", inversedBy="trending") */ private $album; /** *@ORM\OneToOne(targetEntity="Playlist", inversedBy="trending") */ private $playlist; } </code></pre> <p>The playlist entity</p> <pre><code>class Playlist { /** * @var integer * * @ORM\Column(name="id", type="integer") * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="titre", type="string", length=255) */ private $titre; /** * @ORM\Column(name="public", type="boolean") */ private $public = true; /** *@ORM\ManyToOne(targetEntity="user", inversedBy="playlists") *@ORM\joinColumn(nullable=false) */ private $user; /** *@ORM\ManyToMany(targetEntity="Song", inversedBy="playlists") *@ORM\joinColumn(nullable=false) */ private $songs; /** *@ORM\ManyToMany(targetEntity="Genre", inversedBy="playlists") */ private $genres; /** *@ORM\OneToOne(targetEntity="Image", cascade={"persist","remove","refresh"}) */ private $image; /** *@ORM\ManyToMany(targetEntity="user", inversedBy="playlistLikes") *@ORM\JoinTable(name="playlist_likes") */ private $likes; /** *@ORM\Column(name="played", type="integer") */ private $played; /** *@ORM\ManyToMany(targetEntity="user", inversedBy="playlistDislikes") *@ORM\JoinTable(name="playlist_dislikes") */ private $dislikes; /** *@ORM\Column(name="description", type="text", nullable=true) */ private $description; /** *@ORM\ManyToMany(targetEntity="Langue", inversedBy="playlist") */ private $languages; /** *@ORM\Column(name="lien", type="string", length=255) */ private $lien; /** *@ORM\OneToOne(targetEntity="Trending", mappedBy="playlist", cascade= {"persist","remove"}) */ private $trending; } </code></pre> <p>The </p> <p>Trending table</p> <pre><code>id | playlist_id | song_id | album_id 54 | 9 | null | null </code></pre> <p>The playlist table</p> <pre><code>id | title 9 | My best </code></pre> <p>The playlist_genre table</p> <pre><code>playlist_id | genre_id 9 | 1 9 | 4 </code></pre> <p>The genre table</p> <pre><code>id | name 1 | Hip Hop 2 | Konpa 3 | Electronic 4 | Reggae </code></pre> <p>I would like to select any playlist where the genre_id is 4.</p> <p>Thanks.</p>