public function __construct(Broadcast $broadcast) { $this->broadcast = $broadcast; $this->template = $broadcast->getCategory()->getHtmlTemplate(); $this->placeholders = new ArrayCollection(); $this->receivers = $broadcast->getReceivers(); $this->title = $broadcast->getCategory()->getDefaultTitle(); $this->shortText = $broadcast->getCategory()->getDefaultShortText(); }
private function sendBroadcast(Broadcast $broadcast, $shortText, $title) { $helper = $this->get('notifications.helper'); $html = $broadcast->getHtmlTemplate(); foreach ($broadcast->getReceivers() as $person) { $notification = new Notification(); $notification->setIcon($broadcast->getCategory()->getDefaultIcon()); //$notification->setCallbackUrl("url"); $notification->setShortText($shortText); $notification->setTitle($title); $notification->setHtmlTemplate($html); $notification->setPerson($person); $notification->setSender($broadcast->getCategory()->getClient()); $notification->setCategory($broadcast->getCategory()); $notification->setMailTemplate($broadcast->getMailTemplate()); $helper->send($notification); } }