Compare commits
3 Commits
0a94936389
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a8289ceadc | |||
| d8f693651d | |||
| 4ae36306aa |
@@ -95,4 +95,5 @@ RUN set -eux; \
|
|||||||
composer dump-autoload --classmap-authoritative --no-dev; \
|
composer dump-autoload --classmap-authoritative --no-dev; \
|
||||||
composer dump-env prod; \
|
composer dump-env prod; \
|
||||||
composer run-script --no-dev post-install-cmd; \
|
composer run-script --no-dev post-install-cmd; \
|
||||||
chmod +x bin/console; sync;
|
chmod +x bin/console; \
|
||||||
|
sync;
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"auto-scripts": {
|
"auto-scripts": {
|
||||||
"cache:clear": "symfony-cmd",
|
"cache:clear": "symfony-cmd",
|
||||||
|
"asset-map:compile": "symfony-cmd",
|
||||||
"assets:install %PUBLIC_DIR%": "symfony-cmd",
|
"assets:install %PUBLIC_DIR%": "symfony-cmd",
|
||||||
"importmap:install": "symfony-cmd"
|
"importmap:install": "symfony-cmd"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use App\Entity\Branch;
|
|||||||
use App\Entity\Message;
|
use App\Entity\Message;
|
||||||
use App\Form\CreateMessageType;
|
use App\Form\CreateMessageType;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
@@ -14,8 +15,10 @@ use Symfony\Component\Routing\Attribute\Route;
|
|||||||
#[Route('/branches')]
|
#[Route('/branches')]
|
||||||
final class BranchController extends AbstractController
|
final class BranchController extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(private readonly EntityManagerInterface $entityManager)
|
public function __construct(
|
||||||
{
|
private readonly EntityManagerInterface $entityManager,
|
||||||
|
private readonly LoggerInterface $logger,
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/{id}', name: 'branch', methods: ['GET'])]
|
#[Route('/{id}', name: 'branch', methods: ['GET'])]
|
||||||
@@ -39,6 +42,12 @@ final class BranchController extends AbstractController
|
|||||||
|
|
||||||
$this->entityManager->persist($message);
|
$this->entityManager->persist($message);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
$this->logger->info('Created message with id {messageId}', ['messageId' => $message->getId()]);
|
||||||
|
} else {
|
||||||
|
$this->logger->warning('Cant create message', [
|
||||||
|
'isFormSubmitted' => $form->isSubmitted(),
|
||||||
|
'isFormValid' => $form->isValid(),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->redirectToRoute('branch', ['id' => $branch->getId()]);
|
return $this->redirectToRoute('branch', ['id' => $branch->getId()]);
|
||||||
|
|||||||
Reference in New Issue
Block a user