Add children() method to Newsletter model to get child newsletters (history in case of post notif)
- added conditional display of "view history" link in Notification listing - fixed indentation in duplicatePostNotif method according to code sniffer report
This commit is contained in:
@ -123,7 +123,8 @@ class Newsletter extends Model {
|
||||
'parent_id' => $this->id,
|
||||
'type' => self::TYPE_NOTIFICATION_HISTORY,
|
||||
'status' => self::STATUS_SENDING
|
||||
));
|
||||
)
|
||||
);
|
||||
|
||||
$notification_history = self::create();
|
||||
$notification_history->hydrate($data);
|
||||
@ -163,6 +164,14 @@ class Newsletter extends Model {
|
||||
return parent::delete();
|
||||
}
|
||||
|
||||
function children() {
|
||||
return $this->has_many(
|
||||
__NAMESPACE__.'\Newsletter',
|
||||
'parent_id',
|
||||
'id'
|
||||
);
|
||||
}
|
||||
|
||||
function segments() {
|
||||
return $this->has_many_through(
|
||||
__NAMESPACE__.'\Segment',
|
||||
@ -177,6 +186,11 @@ class Newsletter extends Model {
|
||||
return $this;
|
||||
}
|
||||
|
||||
function withChildrenCount() {
|
||||
$this->children_count = $this->children()->count();
|
||||
return $this;
|
||||
}
|
||||
|
||||
function options() {
|
||||
return $this->has_many_through(
|
||||
__NAMESPACE__.'\NewsletterOptionField',
|
||||
|
Reference in New Issue
Block a user