/** * Returns user notifications for the given user * * @param UserInterface $user * @param int $offset * @param int $limit * * @return UserNotificationInterface[] * * @deprecated will be removed in 1.7. Please use Pim\Bundle\NotificationBundle\Entity\Repository\UserNotificationRepository::findBy() */ public function getUserNotifications(UserInterface $user, $offset, $limit = 10) { return $this->userNotifRepository->findBy(['user' => $user], ['id' => 'DESC'], $limit, $offset); }
/** * List user notifications for the current user * * @param Request $request * * @return JsonResponse */ public function listAction(Request $request) { $user = $this->userContext->getUser(); $notifications = $this->userNotifRepository->findBy(['user' => $user], ['id' => 'DESC'], 10, $request->get('skip', 0)); return $this->templating->renderResponse('PimNotificationBundle:Notification:list.json.twig', ['userNotifications' => $notifications], new JsonResponse()); }