NotificationRepository.php 772 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace AppBundle\Entity\Core\Repository;
  3. use Doctrine\ORM\EntityRepository;
  4. use AppBundle\Entity\AccessAndFunction\Access;
  5. /**
  6. * Description of NotificationRepository
  7. *
  8. * @author sebastienhupin
  9. */
  10. class NotificationRepository extends EntityRepository {
  11. /**
  12. * Find notification are not viewed by the user
  13. *
  14. * @param array $ids
  15. *
  16. * @return Array
  17. */
  18. public function findByIds(Array $ids) {
  19. $em = $this->getEntityManager();
  20. $qb = $em->createQueryBuilder('n');
  21. $qb->select('n')
  22. ->from($this->getClassName(), 'n')
  23. ->where($qb->expr()->in('n.id', ':ids'))
  24. ->setParameter('ids', $ids)
  25. ;
  26. return $qb->getQuery()->getResult();
  27. }
  28. }