I am trying to make a API for my app and I want to include 3 tables in one get.
This is how I get it now
{
id: 1,
tocht_id: 1,
user_id: 1,
started_bool: true,
finished_bool: false
},
I want to get the data like this
{
id: 1,
tocht {
id: 1
naam: intro tocht
opleiding: testOpleiding
informatie: testInfo }
user {
id: 1
naam: vincent
pin: 666 }
started_bool: true,
finished_bool: false
},
This is my code to get the data
public function getAction()
{
$restresult = $this->getDoctrine()->getRepository('AppBundle:Koppel_tocht_user')->findAll();
if ($restresult === null)
{
return new View("there are no records to display.", Response::HTTP_NOT_FOUND);
}
return $restresult;
}
Is there an easy way to do this in doctrine?