symfony-notifications/NotificationsBundle/Controller/MainController.php

19 lines
492 B
PHP
Raw Normal View History

2019-03-01 12:18:06 +01:00
<?php
2019-03-01 12:49:26 +01:00
namespace Bluesquare\NotificationsBundle\Controller;
2019-03-01 12:18:06 +01:00
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class MainController extends AbstractController
{
2019-03-01 14:20:14 +01:00
public function myUser()
2019-03-01 12:18:06 +01:00
{
2019-03-01 14:20:14 +01:00
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
2019-03-01 13:19:12 +01:00
$notifssrv = $this->get('bluesquare.notifications_bundle.notifssrv');
2019-03-01 14:20:14 +01:00
$user = $this->getUser();
$notifs = $notifssrv->getForUser($user, true);
return $this->json($notifs);
2019-03-01 12:18:06 +01:00
}
}