deblan.tv/vendor/trinity/src/Trinity/Bundle/NotificationBundle/Notifier/AbstractNotifier.php
2015-03-02 21:57:49 +01:00

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();
}
}