public function removeNotification(array $notifiables, NotificationInterface $notification, $flush = false)
    {
        $repo = $this->om->getRepository('MgiletNotificationBundle:NotifiableNotification');
        foreach ($notifiables as $notifiable) {
            $repo->createQueryBuilder('nn')
                ->delete()
                ->where('nn.notifiableEntity = :entity')
                ->andWhere('nn.notification = :notification')
                ->setParameter('entity', $this->getNotifiableEntity($notifiable))
                ->setParameter('notification', $notification)
                ->getQuery()
                ->execute();

            $event = new NotificationEvent($notification, $notifiable);
            $this->dispatcher->dispatch(MgiletNotificationEvents::REMOVED, $event);
        }

        $this->flush($flush);
    }
public function removeNotification(array $notifiables, NotificationInterface $notification, $flush = false)
    {
        $repo = $this->om->getRepository('MgiletNotificationBundle:NotifiableNotification');
        foreach ($notifiables as $notifiable) {
            $repo->createQueryBuilder('nn')
                ->delete()
                ->where('nn.notifiableEntity = :entity')
                ->andWhere('nn.notification = :notification')
                ->setParameter('entity', $this->getNotifiableEntity($notifiable))
                ->setParameter('notification', $notification)
                ->getQuery()
                ->execute();

            $event = new NotificationEvent($notification, $notifiable);
            $this->dispatcher->dispatch(MgiletNotificationEvents::REMOVED, $event);
        }

        $this->flush($flush);
    }
public function removeNotification ( array $ notifiables , NotificationInterface $ notification , $ flush = false ) { $ repo = $ this -> om -> getRepository ( 'MgiletNotificationBundle:NotifiableNotification' ) ; foreach ( $ notifiables as $ notifiable ) { $ repo -> createQueryBuilder ( 'nn' ) -> delete ( ) -> where ( 'nn.notifiableEntity = :entity' ) -> andWhere ( 'nn.notification = :notification' ) -> setParameter ( 'entity' , $ this -> getNotifiableEntity ( $ notifiable ) ) -> setParameter ( 'notification' , $ notification ) -> getQuery ( ) -> execute ( ) ; $ event = new NotificationEvent ( $ notification , $ notifiable ) ; $ this -> dispatcher -> dispatch ( MgiletNotificationEvents :: REMOVED , $ event ) ; } $ this -> flush ( $ flush ) ; }
Deletes the link between a Notifiable and a Notification

@param array                 $notifiables
@param NotificationInterface $notification
@param bool                  $flush

@throws \Doctrine\ORM\ORMInvalidArgumentException
@throws \Doctrine\ORM\OptimisticLockException
@throws \InvalidArgumentException
@throws \RuntimeException
Deletes the link between a Notifiable and a Notification