message
This commit is contained in:
parent
9a75d46972
commit
80f18f7fc8
@ -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);
|
||||
|
@ -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',
|
||||
])
|
||||
;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user