Commit d8c1f9d1 authored by Julien Fastré's avatar Julien Fastré

adapt to support admin users

parent 8f4be568
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment