Background
I have a Discipline
and a Playlist
class.
A discipline can have zero to many playlists
A playlist can only be associated with one discipline
In my Controller, I have
$repository = $this->getDoctrine()
->getRepository('NodeBundle:Discipline');
$disciplines = $repository->findAll();
My discipline
and playlist
tables are pretty straightforward, but then there's a discipline_playlist
link table, with id
, discipline_id (FK)
, and playlist_id (FK)
.
Problem
What I'd like is for Doctrine to give me the Discipline objects, complete with an Array/Collection of Playlist objects.
Can this be achieved using Doctrine alone, or do I need to fetch the Playlists separately, and link them together in my controller (PHP)?