I have an entity named "Courses" that has a series of attributes and one of them is "shop" which is an onetomany relation with a Entity "Shop"
In the controller I have done an action that what it does is to return a JSON by applying a series of search filters, this I use later with bootstrap-table to present it visually
In the controller I have this code
/**
* @param Request $request
* @Route("/find/", name="admin_curso_find")
* @return JsonResponse
*/
public function findAcademicProgram(Request $request)
{
$search=$request->query->get('search');
$em = $this->getDoctrine()->getManager();
$query = $em->createQuery(
'SELECT a FROM AppBundle:AcademicAgreement a
where a.code LIKE :search ')
->setParameter('search', '%' . $search . '%');
$ap = $query->getArrayResult();
return new JsonResponse($ap);
}
And this returns a JSON of this style
[{"id": 1, "code": "12213", "enabled": false, "createdAt": null, "updatedAt": null, "disabledAt": {"date": "2018-01 -18 09: 36: 49.000000 "," timezone_type ": 3," timezone ":" Europe / Berlin "}}
But in the entity I have another field like the "shop" which is the relationship I mentioned earlier and this field the previous code does not return it to me.
Thanks