diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 417c04909..09f6e0c80 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -36,6 +36,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Role\Role; use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Form\ActivityType; +use Symfony\Component\Serializer\SerializerInterface; /** * Class ActivityController @@ -49,15 +50,19 @@ class ActivityController extends AbstractController protected AuthorizationHelper $authorizationHelper; protected LoggerInterface $logger; + + protected SerializerInterface $serializer; public function __construct( EventDispatcherInterface $eventDispatcher, AuthorizationHelper $authorizationHelper, - LoggerInterface $logger + LoggerInterface $logger, + SerializerInterface $serializer ) { $this->eventDispatcher = $eventDispatcher; $this->authorizationHelper = $authorizationHelper; $this->logger = $logger; + $this->serializer = $serializer; } /** @@ -204,11 +209,25 @@ 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 = null; + // activity_json doit retourner qqch comme : + // { + // "type": "activity", + // "persons": [ + // { type: person, id: xxx, ...} + // { ...} + // ], "" + // } + return $this->render($view, [ 'person' => $person, 'accompanyingCourse' => $accompanyingPeriod, 'entity' => $entity, 'form' => $form->createView(), + 'activity_json' => $activity_json ]); } @@ -321,6 +340,7 @@ class ActivityController extends AbstractController 'delete_form' => $deleteForm->createView(), 'person' => $person, 'accompanyingCourse' => $accompanyingPeriod, + 'activity_json' => null )); } diff --git a/src/Bundle/parcours.html b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/parcours.html similarity index 100% rename from src/Bundle/parcours.html rename to src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/parcours.html diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig index 74152659f..aa532b323 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newAccompanyingCourse.html.twig @@ -6,15 +6,27 @@ {% block content %} {% include 'ChillActivityBundle:Activity:new.html.twig' %} + {{ dump() }} {% endblock %} {% block js %} + {{ encore_entry_script_tags('vue_activity') }} {% endblock %} {% block css %} + {{ encore_entry_link_tags('vue_activity') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig index 9cb89d917..5155e9242 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/newPerson.html.twig @@ -12,9 +12,12 @@ + {{ encore_entry_script_tags('vue_activity') }} {% endblock %} {% block css %} + {{ encore_entry_link_tags('vue_activity') }} {% endblock %} diff --git a/src/Bundle/ChillActivityBundle/config/services/controller.yaml b/src/Bundle/ChillActivityBundle/config/services/controller.yaml index cf36e482d..106b2c6e4 100644 --- a/src/Bundle/ChillActivityBundle/config/services/controller.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/controller.yaml @@ -4,4 +4,5 @@ services: $eventDispatcher: '@Symfony\Component\EventDispatcher\EventDispatcherInterface' $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper' $logger: '@chill.main.logger' + $serializer: '@Symfony\Component\Serializer\SerializerInterface' tags: ['controller.service_arguments']