mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-25 17:13:49 +00:00
add serializer to activityController
This commit is contained in:
@@ -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
|
||||
));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user