diff --git a/src/Controller/MessageController.php b/src/Controller/MessageController.php index f46276b..55eb5ba 100644 --- a/src/Controller/MessageController.php +++ b/src/Controller/MessageController.php @@ -30,6 +30,10 @@ final class MessageController extends AbstractController $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + + $message->setSendingDate(new \DateTime()); + $message->setSender($this->getUser()); + $entityManager->persist($message); $entityManager->flush(); @@ -57,6 +61,7 @@ final class MessageController extends AbstractController $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { + $message->setSendingDate(new \DateTime()); $entityManager->flush(); return $this->redirectToRoute('app_message_index', [], Response::HTTP_SEE_OTHER); diff --git a/src/Form/MessageType.php b/src/Form/MessageType.php index b1208d9..a83cdda 100644 --- a/src/Form/MessageType.php +++ b/src/Form/MessageType.php @@ -15,16 +15,10 @@ class MessageType extends AbstractType { $builder ->add('content') - ->add('sendingDate', null, [ - 'widget' => 'single_text', - ]) - ->add('sender', EntityType::class, [ - 'class' => UserApp::class, - 'choice_label' => 'id', - ]) + ->add('receiver', EntityType::class, [ 'class' => UserApp::class, - 'choice_label' => 'id', + 'choice_label' => 'nickname', ]) ; } diff --git a/templates/base.html.twig b/templates/base.html.twig index 0f85cf3..f65d613 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -27,9 +27,9 @@
@@ -60,7 +60,7 @@

Liens utiles

diff --git a/templates/index/index.html.twig b/templates/index/index.html.twig index 8fb84d2..ff61a24 100644 --- a/templates/index/index.html.twig +++ b/templates/index/index.html.twig @@ -41,7 +41,7 @@

Propositions de stages

- Voir tout + Voir tout