diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index beaff22d4..a454626b7 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -39,6 +39,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Core\Role\Role; use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Form\ActivityType; +use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use Symfony\Component\Serializer\SerializerInterface; /** @@ -236,6 +237,15 @@ class ActivityController extends AbstractController $entity->addThirdParty($professional); } } + + if (array_key_exists('comment', $activityData)) { + $comment = new CommentEmbeddable(); + $comment->setComment($activityData['comment']); + $comment->setUserId($this->getUser()->getid()); + $comment->setDate(new \DateTime('now')); + $entity->setComment($comment); + } + } // TODO revoir le Voter de Activity pour tenir compte qu'une activité peut appartenir a une période diff --git a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php index c87f7ebd1..71e461464 100644 --- a/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php +++ b/src/Bundle/ChillCalendarBundle/Controller/CalendarController.php @@ -233,7 +233,8 @@ class CalendarController extends AbstractController 'personsId' => $personsId, 'professionalsId' => $professionalsId, 'date' => $entity->getStartDate()->format('Y-m-d'), - 'durationTime' => $durationTimeInMinutes + 'durationTime' => $durationTimeInMinutes, + 'comment' => $entity->getComment()->getComment(), ]; return $this->render($view, [