feat: decouple logic using events
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user