0
我想爲我的應用程序做一個API,我想在一個get中包含3個表。如何使一個學說多級API
這是我如何得到它現在
{
id: 1,
tocht_id: 1,
user_id: 1,
started_bool: true,
finished_bool: false
},
我想要得到的數據是這樣
{
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
},
這是我的代碼來獲取數據
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;
}
有在教條中做到這一點的簡單方法?