mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 14:36:13 +00:00
adapt to support admin users
This commit is contained in:
parent
8f4be568e9
commit
d8c1f9d1dc
@ -18,6 +18,7 @@
|
||||
namespace Chill\TaskBundle\Templating\UI;
|
||||
|
||||
use Chill\MainBundle\Templating\UI\NotificationCounterInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\TaskBundle\Repository\SingleTaskRepository;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
@ -52,8 +53,12 @@ class CountNotificationTask implements NotificationCounterInterface
|
||||
$this->cachePool = $cachePool;
|
||||
}
|
||||
|
||||
public function countNotification(User $u): int
|
||||
public function countNotification(UserInterface $u): int
|
||||
{
|
||||
if (!$u instanceof User) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sumCache = $this->cachePool->getItem($this->getCacheKey($u));
|
||||
|
||||
if ($sumCache->isHit()) {
|
||||
@ -82,7 +87,7 @@ class CountNotificationTask implements NotificationCounterInterface
|
||||
return $sum;
|
||||
}
|
||||
|
||||
public function addNotification(User $u): int
|
||||
public function addNotification(UserInterface $u): int
|
||||
{
|
||||
return $this->countNotification($u);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user