feat(notification) : hook NotificationService into ticket processors
This commit is contained in:
@@ -9,6 +9,7 @@ use ApiPlatform\State\ProcessorInterface;
|
|||||||
use App\Entity\ClientTicket;
|
use App\Entity\ClientTicket;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Repository\ClientTicketRepository;
|
use App\Repository\ClientTicketRepository;
|
||||||
|
use App\Service\NotificationService;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\SecurityBundle\Security;
|
use Symfony\Bundle\SecurityBundle\Security;
|
||||||
@@ -24,6 +25,7 @@ final readonly class ClientTicketNumberProcessor implements ProcessorInterface
|
|||||||
private EntityManagerInterface $entityManager,
|
private EntityManagerInterface $entityManager,
|
||||||
private Security $security,
|
private Security $security,
|
||||||
private ClientTicketRepository $clientTicketRepository,
|
private ClientTicketRepository $clientTicketRepository,
|
||||||
|
private NotificationService $notificationService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): ClientTicket
|
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): ClientTicket
|
||||||
@@ -56,6 +58,8 @@ final readonly class ClientTicketNumberProcessor implements ProcessorInterface
|
|||||||
$this->entityManager->persist($data);
|
$this->entityManager->persist($data);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
$this->notificationService->createForTicketCreated($data);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace App\State;
|
|||||||
use ApiPlatform\Metadata\Operation;
|
use ApiPlatform\Metadata\Operation;
|
||||||
use ApiPlatform\State\ProcessorInterface;
|
use ApiPlatform\State\ProcessorInterface;
|
||||||
use App\Entity\ClientTicket;
|
use App\Entity\ClientTicket;
|
||||||
|
use App\Service\NotificationService;
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||||
@@ -23,6 +24,7 @@ final readonly class ClientTicketStatusProcessor implements ProcessorInterface
|
|||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private EntityManagerInterface $entityManager,
|
private EntityManagerInterface $entityManager,
|
||||||
|
private NotificationService $notificationService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): ClientTicket
|
public function process(mixed $data, Operation $operation, array $uriVariables = [], array $context = []): ClientTicket
|
||||||
@@ -51,6 +53,8 @@ final readonly class ClientTicketStatusProcessor implements ProcessorInterface
|
|||||||
$this->entityManager->persist($data);
|
$this->entityManager->persist($data);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
$this->notificationService->createForStatusChange($data);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user