This commit is contained in:
PaulCombal
2019-03-01 14:20:14 +01:00
parent 1c61cec992
commit a98aa394ac
4 changed files with 126 additions and 19 deletions

View File

@@ -2,21 +2,18 @@
namespace Bluesquare\NotificationsBundle\Controller;
use Bluesquare\NotificationsBundle\Service\NotificationsService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
class MainController extends AbstractController
{
/**
* @param Request $request
*/
public function index(Request $request)
public function myUser()
{
// ON PEUT PAS INJECTER UN SERVICE DU BUNDLE EN QUESTION DANS LES ARGS DONC ON LE récupère ainsi :
/** @var NotificationsService $notifssrv */
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
$notifssrv = $this->get('bluesquare.notifications_bundle.notifssrv');
$r = $notifssrv->notifyUsers();
die($r);
$user = $this->getUser();
$notifs = $notifssrv->getForUser($user, true);
return $this->json($notifs);
}
}