
namespace Cocorico\CoreBundle\Repository;

use Cocorico\UserBundle\Entity\User;
use Doctrine\ORM\EntityRepository;

class AnnouncementToUserRepository extends EntityRepository
{
    public function getAnnouncementsWithCache(User $user)
    {
        $qb = $this->createQueryBuilder('au')
            ->leftJoin('au.announcement', 'a')
            ->andWhere('au.user = :user')
            ->andWhere('au.dismissed = 0')