This commit is contained in:
allavenavr 2024-12-12 14:41:59 +01:00 committed by bourgoino
parent 9a75d46972
commit 80f18f7fc8
2 changed files with 7 additions and 8 deletions

View File

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

View File

@ -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',
])
;
}