- Updates cron's sending queue worker to use model objects
- Adds new method to render newsletter to the newsletter model - Adds new transient object to newsletter model that will hold temporary values (i.e., rendered body) when working with the model
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
namespace MailPoet\Models;
|
||||
use MailPoet\Newsletter\Renderer\Renderer;
|
||||
use MailPoet\Util\Helpers;
|
||||
|
||||
if(!defined('ABSPATH')) exit;
|
||||
|
||||
class Newsletter extends Model {
|
||||
public static $_table = MP_NEWSLETTERS_TABLE;
|
||||
|
||||
public $_transient;
|
||||
const TYPE_STANDARD = 'standard';
|
||||
const TYPE_WELCOME = 'welcome';
|
||||
const TYPE_NOTIFICATION = 'notification';
|
||||
@@ -22,7 +23,7 @@ class Newsletter extends Model {
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
|
||||
$this->_transient = new \stdClass();
|
||||
$this->addValidations('type', array(
|
||||
'required' => __('Please specify a type')
|
||||
));
|
||||
@@ -246,6 +247,11 @@ class Newsletter extends Model {
|
||||
return $this;
|
||||
}
|
||||
|
||||
function render() {
|
||||
$renderer = new Renderer($this);
|
||||
return $renderer->render();
|
||||
}
|
||||
|
||||
function getStatistics() {
|
||||
$statistics_query = SendingQueue::tableAlias('queues')
|
||||
->selectExpr(
|
||||
|
Reference in New Issue
Block a user