mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-04 05:44:58 +00:00
Merge branch 'master' into upgrade-sf5
This commit is contained in:
@@ -17,13 +17,16 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Repository\NotificationRepository;
|
||||
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
||||
use Doctrine\ORM\Event\PostPersistEventArgs;
|
||||
use Doctrine\ORM\Event\PostUpdateEventArgs;
|
||||
use Doctrine\ORM\Event\PreFlushEventArgs;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
final readonly class NotificationByUserCounter implements NotificationCounterInterface
|
||||
{
|
||||
public function __construct(private CacheItemPoolInterface $cacheItemPool, private NotificationRepository $notificationRepository) {}
|
||||
public function __construct(private CacheItemPoolInterface $cacheItemPool, private NotificationRepository $notificationRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function addNotification(UserInterface $u): int
|
||||
{
|
||||
@@ -60,7 +63,12 @@ final readonly class NotificationByUserCounter implements NotificationCounterInt
|
||||
return 'chill_main_notif_unread_by_'.$user->getId();
|
||||
}
|
||||
|
||||
public function onEditNotificationComment(NotificationComment $notificationComment, PostPersistEventArgs $eventArgs): void
|
||||
public function onPersistNotificationComment(NotificationComment $notificationComment, PostPersistEventArgs $eventArgs): void
|
||||
{
|
||||
$this->resetCacheForNotification($notificationComment->getNotification());
|
||||
}
|
||||
|
||||
public function onEditNotificationComment(NotificationComment $notificationComment, PostUpdateEventArgs $eventArgs): void
|
||||
{
|
||||
$this->resetCacheForNotification($notificationComment->getNotification());
|
||||
}
|
||||
|
@@ -24,7 +24,9 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
class NotificationMailer
|
||||
{
|
||||
public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator) {}
|
||||
public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly TranslatorInterface $translator)
|
||||
{
|
||||
}
|
||||
|
||||
public function postPersistComment(NotificationComment $comment, PostPersistEventArgs $eventArgs): void
|
||||
{
|
||||
|
@@ -18,7 +18,9 @@ use Symfony\Component\HttpKernel\Event\TerminateEvent;
|
||||
|
||||
class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberInterface
|
||||
{
|
||||
public function __construct(private readonly EntityManagerInterface $em, private readonly NotificationPersisterInterface $persister) {}
|
||||
public function __construct(private readonly EntityManagerInterface $em, private readonly NotificationPersisterInterface $persister)
|
||||
{
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
|
@@ -11,4 +11,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Notification\Exception;
|
||||
|
||||
class NotificationHandlerNotFound extends \RuntimeException {}
|
||||
class NotificationHandlerNotFound extends \RuntimeException
|
||||
{
|
||||
}
|
||||
|
@@ -34,7 +34,9 @@ class Mailer
|
||||
*
|
||||
* @param mixed[] $routeParameters
|
||||
*/
|
||||
public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly Environment $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters) {}
|
||||
public function __construct(private readonly MailerInterface $mailer, private readonly LoggerInterface $logger, private readonly Environment $twig, private readonly RouterInterface $router, private readonly TranslatorInterface $translator, protected $routeParameters)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
@@ -72,7 +74,7 @@ class Mailer
|
||||
mixed $recipient,
|
||||
array $subject,
|
||||
array $bodies,
|
||||
callable $callback = null,
|
||||
?callable $callback = null,
|
||||
mixed $force = false
|
||||
) {
|
||||
$fromEmail = $this->routeParameters['from_email'];
|
||||
|
@@ -17,7 +17,9 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
final readonly class NotificationHandlerManager
|
||||
{
|
||||
public function __construct(private iterable $handlers, private EntityManagerInterface $em) {}
|
||||
public function __construct(private iterable $handlers, private EntityManagerInterface $em)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @throw NotificationHandlerNotFound if handler is not found
|
||||
|
@@ -23,7 +23,9 @@ class NotificationPresence
|
||||
{
|
||||
private array $cache = [];
|
||||
|
||||
public function __construct(private readonly Security $security, private readonly NotificationRepository $notificationRepository) {}
|
||||
public function __construct(private readonly Security $security, private readonly NotificationRepository $notificationRepository)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array{relatedEntityClass: class-string, relatedEntityId: int}> $more
|
||||
|
@@ -21,7 +21,9 @@ use Twig\Extension\RuntimeExtensionInterface;
|
||||
|
||||
class NotificationTwigExtensionRuntime implements RuntimeExtensionInterface
|
||||
{
|
||||
public function __construct(private readonly FormFactoryInterface $formFactory, private readonly NotificationPresence $notificationPresence, private readonly UrlGeneratorInterface $urlGenerator) {}
|
||||
public function __construct(private readonly FormFactoryInterface $formFactory, private readonly NotificationPresence $notificationPresence, private readonly UrlGeneratorInterface $urlGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
public function counterNotificationFor(Environment $environment, string $relatedEntityClass, int $relatedEntityId, array $more = [], array $options = []): string
|
||||
{
|
||||
|
Reference in New Issue
Block a user