Fix notification error
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"version": "0.2.3"
|
"version": "0.2.4"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\EventSubscriber;
|
namespace App\EventSubscriber;
|
||||||
|
|
||||||
|
use App\Entity\Notification;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use Twig\Environment;
|
use Twig\Environment;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
@@ -42,7 +43,7 @@ class NotificationsSubscriber implements EventSubscriberInterface
|
|||||||
* @var NotificationRepository notificationRepo
|
* @var NotificationRepository notificationRepo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (null === ($notificationRepo = $this->entityManager->getRepository("App:Notification"))) {
|
if (null === ($notificationRepo = $this->entityManager->getRepository(Notification::class))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,19 +59,19 @@ class NotificationsSubscriber implements EventSubscriberInterface
|
|||||||
$this->twig->addGlobal(
|
$this->twig->addGlobal(
|
||||||
'user_notifications_list',
|
'user_notifications_list',
|
||||||
$notificationRepo->listForUser($User)
|
$notificationRepo->listForUser($User)
|
||||||
->readed(false)
|
->readed(false)
|
||||||
->limit(5)
|
->limit(5)
|
||||||
->order(['createdAt' => 'DESC'])
|
->order(['createdAt' => 'DESC'])
|
||||||
->getResult()
|
->getResult()
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->twig->addGlobal(
|
$this->twig->addGlobal(
|
||||||
'user_notifications_count',
|
'user_notifications_count',
|
||||||
$notificationRepo->listForUser($User)
|
$notificationRepo->listForUser($User)
|
||||||
->readed(false)
|
->readed(false)
|
||||||
->limit(5)
|
->limit(5)
|
||||||
->order(['createdAt' => 'DESC'])
|
->order(['createdAt' => 'DESC'])
|
||||||
->getCount()
|
->getCount()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user