feat: further decouple logic using events

This commit is contained in:
Björn Fromme
2024-07-18 12:42:02 +02:00
parent 3a77697d9d
commit a1882a4af1
10 changed files with 127 additions and 68 deletions
@@ -8,7 +8,6 @@ use App\Entity\User;
use App\Event\ApplicationCreatedEvent;
use App\Form\TeamerApplicationType;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -20,8 +19,7 @@ class CreateController extends AbstractController
{
public function __construct(
private readonly EntityManagerInterface $entityManager,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly LoggerInterface $logger
private readonly EventDispatcherInterface $eventDispatcher
) {
}
@@ -48,13 +46,6 @@ class CreateController extends AbstractController
);
$this->addFlash('success', 'Deine Bewerbung wurde entgegengenommen');
$this->logger->info('Create application', [
'teamer_id' => $teamer->getId(),
'teamer_name' => (string) $teamer,
'application_id' => $application->getId(),
'assignment_id' => $assignment->getId(),
'destination' => (string) $assignment->getDestination(),
]);
return $this->redirectToRoute('app_teamer_index');
}