rdv -> activity: add comment

This commit is contained in:
nobohan 2021-09-21 16:48:43 +02:00
parent 1a6c37e5a6
commit d172ae9682
2 changed files with 12 additions and 1 deletions

View File

@ -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

View File

@ -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, [