<?php

namespace AppBundle\Entity\Core\Repository;

use Doctrine\ORM\EntityRepository;
use AppBundle\Entity\AccessAndFunction\Access;

/**
 * Description of NotificationRepository
 *
 * @author sebastienhupin
 */
class NotificationRepository extends EntityRepository {
    
    /**
     * Find notification are not viewed by the user
     * 
     * @param array $ids
     * 
     * @return Array
     */
    public function findByIds(Array $ids) {
        $em = $this->getEntityManager();


        $qb = $em->createQueryBuilder('n');
        $qb->select('n')
            ->from($this->getClassName(), 'n')
            ->where($qb->expr()->in('n.id', ':ids'))
            ->setParameter('ids', $ids)
        ;
        
        return $qb->getQuery()->getResult();
    }
}
