33 lines
732 B
PHP
33 lines
732 B
PHP
<?php
|
|
|
|
namespace Trinity\Bundle\NotificationBundle\Notifier;
|
|
|
|
use Trinity\Bundle\NotificationBundle\Model\TemplateQuery;
|
|
use Trinity\Bundle\NotificationBundle\Model\Notification;
|
|
|
|
abstract class AbstractNotifier
|
|
{
|
|
abstract public function notify($template, array $data = array());
|
|
|
|
protected function loadTemplate($template)
|
|
{
|
|
$obj = TemplateQuery::create()->findOneByReference($template);
|
|
|
|
if(!$obj){
|
|
throw new \Exception(sprintf('Vous devez définir le template "%s"',$template));
|
|
}
|
|
|
|
return $obj;
|
|
}
|
|
|
|
protected function getDefaultData()
|
|
{
|
|
return array();
|
|
}
|
|
|
|
protected function getNewNotification()
|
|
{
|
|
return new Notification();
|
|
}
|
|
}
|