share(function (PhraseaApplication $app) { return (new UserNotificationController($app)) ->setEntityManagerLocator(new LazyLocator($app, 'orm.em')) ; }); } public function boot(Application $app) { // no-op } /** * {@inheritDoc} */ public function connect(Application $app) { $controllers = $this->createAuthenticatedCollection($app); $firewall = $this->getFirewall($app); $controllers->before(function () use ($firewall) { $firewall->requireNotGuest(); }); /** @uses UserNotificationController::getNotifications() */ $controllers->get('/', 'controller.user.notifications:getNotifications') // ->bind('get_notifications') ; $controllers->patch('/{notification_id}/', 'controller.user.notifications:patchNotification') ->assert('notification_id', '\d+') ->bind('set_notifications_readed'); /** @uses UserNotificationController::readAllNotification() */ $controllers->post('/read-all/', 'controller.user.notifications:readAllNotification') ->bind('set_all_notifications_readed'); /* /** @uses UserNotificationController::listNotifications * / $controllers->get('/', 'controller.user.notifications:getNotifications') ->bind('get_notifications'); /** @uses UserNotificationController::readNotifications() * / $controllers->post('/read/', 'controller.user.notifications:readNotifications') ->bind('set_notifications_readed'); */ return $controllers; } }