public function addNotification($notifiables, NotificationInterface $notification, $flush = false)
    {
        foreach ($notifiables as $notifiable) {
            $entity = $this->getNotifiableEntity($notifiable);

            $notifiableNotification = new NotifiableNotification();
            $entity->addNotifiableNotification($notifiableNotification);
            $notification->addNotifiableNotification($notifiableNotification);

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

        $this->flush($flush);
    }
public function addNotification($notifiables, NotificationInterface $notification, $flush = false)
    {
        foreach ($notifiables as $notifiable) {
            $entity = $this->getNotifiableEntity($notifiable);

            $notifiableNotification = new NotifiableNotification();
            $entity->addNotifiableNotification($notifiableNotification);
            $notification->addNotifiableNotification($notifiableNotification);

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

        $this->flush($flush);
    }
public function addNotification ( $ notifiables , NotificationInterface $ notification , $ flush = false ) { foreach ( $ notifiables as $ notifiable ) { $ entity = $ this -> getNotifiableEntity ( $ notifiable ) ; $ notifiableNotification = new NotifiableNotification ( ) ; $ entity -> addNotifiableNotification ( $ notifiableNotification ) ; $ notification -> addNotifiableNotification ( $ notifiableNotification ) ; $ event = new NotificationEvent ( $ notification , $ notifiable ) ; $ this -> dispatcher -> dispatch ( MgiletNotificationEvents :: ASSIGNED , $ event ) ; } $ this -> flush ( $ flush ) ; }
Add a Notification to a list of NotifiableInterface entities

@param NotifiableInterface[] $notifiables
@param NotificationInterface $notification
@param bool                  $flush

@throws \Doctrine\ORM\OptimisticLockException
@throws \Doctrine\ORM\ORMInvalidArgumentException
@throws \InvalidArgumentException
@throws \RuntimeException
Add a Notification to a list of NotifiableInterface entities