feat: decouple logic using events

This commit is contained in:
Björn Fromme
2024-07-18 11:09:49 +02:00
parent 174ae5e5e3
commit 3a77697d9d
13 changed files with 190 additions and 27 deletions
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace App\Event;
use App\Entity\Application;
use Symfony\Contracts\EventDispatcher\Event;
class ApplicationCreatedEvent extends Event
{
public const NAME = 'application.created';
public function __construct(private readonly Application $application)
{}
public function getApplication(): Application
{
return $this->application;
}
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace App\Event;
use App\Entity\Application;
use Symfony\Contracts\EventDispatcher\Event;
class ApplicationDeletedEvent extends Event
{
public const NAME = 'application.deleted';
public function __construct(private readonly Application $application)
{}
public function getApplication(): Application
{
return $this->application;
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Event;
use App\Entity\Upload;
use Symfony\Contracts\EventDispatcher\Event;
class DocumentConfirmedEvent extends Event
{
public const NAME = 'document.confirmed';
public function __construct(private readonly Upload $document)
{
}
public function getDocument(): Upload
{
return $this->document;
}
}