WIP: Refactor application rejecting process
This commit is contained in:
@@ -24,7 +24,7 @@ class IndexController extends AbstractController
|
||||
{
|
||||
$query = $this
|
||||
->applicationRepository
|
||||
->getListQuery()
|
||||
->getPendingQuery()
|
||||
;
|
||||
|
||||
$pagination = $this->paginator->paginate(
|
||||
|
||||
@@ -3,17 +3,21 @@
|
||||
namespace App\Controller\Admin\Application;
|
||||
|
||||
use App\Entity\Application;
|
||||
use App\Event\ApplicationRejectedEvent;
|
||||
use App\Model\ApplicationCheckDto;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Security\Http\Attribute\IsGranted;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
|
||||
|
||||
class RejectController extends AbstractController
|
||||
{
|
||||
public function __construct(
|
||||
private readonly EntityManagerInterface $entityManager,
|
||||
private readonly EventDispatcherInterface $eventDispatcher,
|
||||
private readonly LoggerInterface $logger
|
||||
) {
|
||||
}
|
||||
@@ -23,6 +27,9 @@ class RejectController extends AbstractController
|
||||
#[IsGranted('REJECT', subject: 'application')]
|
||||
public function index(Application $application): Response
|
||||
{
|
||||
$applicationCheckDto = new ApplicationCheckDto($application);
|
||||
$this->eventDispatcher->dispatch(new ApplicationRejectedEvent($applicationCheckDto), ApplicationRejectedEvent::NAME);
|
||||
|
||||
$application->setStatus(Application::STATUS_REJECTED);
|
||||
|
||||
$this->entityManager->flush();
|
||||
|
||||
Reference in New Issue
Block a user