diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php index 08deac745..4c09aaa55 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/NotificationNormalizer.php @@ -44,7 +44,6 @@ class NotificationNormalizer implements NormalizerAwareInterface, NormalizerInte */ public function normalize($object, ?string $format = null, array $context = []) { - dump($object); $entity = $this->entityManager ->getRepository($object->getRelatedEntityClass()) ->find($object->getRelatedEntityId()); diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php index 1bb4bc1fe..757e8df79 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingPeriodWorkEvaluationApiController.php @@ -99,7 +99,7 @@ class AccompanyingPeriodWorkEvaluationApiController if ($request->query->getBoolean('countOnly', false)) { return new JsonResponse( - $this->serializer->serialize(new Counter($total), 'json', ['groups' => 'read']), + $this->serializer->serialize(new Counter($total), 'json', ['groups' => ['read']]), JsonResponse::HTTP_OK, [], true @@ -117,7 +117,7 @@ class AccompanyingPeriodWorkEvaluationApiController $collection = new Collection($works, $paginator); return new JsonResponse( - $this->serializer->serialize($collection, 'json', ['groups' => 'read']), + $this->serializer->serialize($collection, 'json', ['groups' => ['read', 'read:evaluation:include-work']]), JsonResponse::HTTP_OK, [], true diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php index 97424c2e3..9a80fde3d 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWork.php @@ -44,7 +44,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues { /** * @ORM\ManyToOne(targetEntity=AccompanyingPeriod::class) - * @Serializer\Groups({"read"}) + * @Serializer\Groups({"read","read:accompanyingPeriodWork:light"}) */ private ?AccompanyingPeriod $accompanyingPeriod = null; @@ -63,26 +63,26 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @ORM\Column(type="datetime_immutable") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private ?DateTimeImmutable $createdAt = null; /** * @ORM\Column(type="boolean") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private bool $createdAutomatically = false; /** * @ORM\Column(type="text") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private string $createdAutomaticallyReason = ''; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private ?User $createdBy = null; @@ -90,7 +90,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\Column(type="date_immutable", nullable=true, options={"default": null}) * @Serializer\Groups({"accompanying_period_work:create"}) * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) * @Assert\GreaterThan(propertyPath="startDate", * message="accompanying_course_work.The endDate should be greater than the start date" * ) @@ -122,7 +122,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light", "read:evaluation:include-work"}) */ private ?int $id = null; @@ -135,7 +135,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @ORM\ManyToMany(targetEntity=Person::class) * @ORM\JoinTable(name="chill_person_accompanying_period_work_person") - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) * @Serializer\Groups({"accompanying_period_work:edit"}) * @Serializer\Groups({"accompanying_period_work:create"}) */ @@ -151,8 +151,9 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues /** * @ORM\ManyToOne(targetEntity=SocialAction::class) - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) * @Serializer\Groups({"accompanying_period_work:create"}) + * @Serializer\Context(normalizationContext={"groups"={"read"}}, groups={"read:accompanyingPeriodWork:light"}) */ private ?SocialAction $socialAction = null; @@ -160,7 +161,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues * @ORM\Column(type="date_immutable") * @Serializer\Groups({"accompanying_period_work:create"}) * @Serializer\Groups({"accompanying_period_work:edit"}) - * @Serializer\Groups({"read", "docgen:read"}) + * @Serializer\Groups({"read", "docgen:read", "read:accompanyingPeriodWork:light"}) */ private ?DateTimeImmutable $startDate = null; diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php index f9fbc95f9..483495ebd 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/AccompanyingPeriodWorkEvaluation.php @@ -39,6 +39,8 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU * targetEntity=AccompanyingPeriodWork::class, * inversedBy="accompanyingPeriodWorkEvaluations" * ) + * @Serializer\Groups({"read:evaluation:include-work"}) + * @Serializer\Context(normalizationContext={"groups"={"read:accompanyingPeriodWork:light"}}, groups={"read:evaluation:include-work"}) */ private ?AccompanyingPeriodWork $accompanyingPeriodWork = null; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php index 1e4649dd7..a5156a78a 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/AccompanyingPeriodWorkEvaluationNormalizer.php @@ -44,6 +44,7 @@ class AccompanyingPeriodWorkEvaluationNormalizer implements ContextAwareNormaliz */ public function normalize($object, ?string $format = null, array $context = []): array { + dump($context); $initial = $this->normalizer->normalize($object, $format, array_merge( $context, [self::IGNORE_EVALUATION => spl_object_hash($object)] diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php index b20df016a..2dc51335c 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php @@ -109,7 +109,6 @@ final class AccompanyingPeriodConfidentialTest extends WebTestCase $user = new stdClass(); $user->id = 0; $user->type = 'user'; - dump($user); $this->client->request( Request::METHOD_PATCH,