controller return json to vue via twig; init vue App

This commit is contained in:
2021-05-27 17:36:33 +02:00
parent b89cffce68
commit b1d7e543fc
11 changed files with 138 additions and 52 deletions

View File

@@ -209,19 +209,8 @@ class ActivityController extends AbstractController
throw $this->createNotFoundException('Template not found');
}
//$activity_json = $this->serializer->serialize($entity, 'json', []);
// "A circular reference has been detected when serializing the object of class "Chill\PersonBundle\Entity\AccompanyingPeriod" (configured limit: 1)."
$activity_json = $this->serializer->serialize($entity, 'json', ['groups' => 'read']);
$activity_json = null;
// activity_json doit retourner qqch comme :
// {
// "type": "activity",
// "persons": [
// { type: person, id: xxx, ...}
// { ...}
// ], ""
// }
return $this->render($view, [
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
@@ -334,13 +323,15 @@ class ActivityController extends AbstractController
throw $this->createNotFoundException('Template not found');
}
$activity_json = $this->serializer->serialize($entity, 'json', ['groups' => ['read']]);
return $this->render($view, array(
'entity' => $entity,
'edit_form' => $form->createView(),
'delete_form' => $deleteForm->createView(),
'person' => $person,
'accompanyingCourse' => $accompanyingPeriod,
'activity_json' => null
'activity_json' => $activity_json
));
}