Make sure types are correct in models
[MAILPOET-2716]
This commit is contained in:
@ -119,9 +119,9 @@ class Newsletter extends Model {
|
|||||||
$this->set_expr('deleted_at', 'NULL');
|
$this->set_expr('deleted_at', 'NULL');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->body)) {
|
if (isset($this->body) && ($this->body !== false)) {
|
||||||
if (is_array($this->body)) {
|
if (is_array($this->body)) {
|
||||||
$this->body = json_encode($this->body);
|
$this->body = (string)json_encode($this->body);
|
||||||
}
|
}
|
||||||
$this->set(
|
$this->set(
|
||||||
'body',
|
'body',
|
||||||
|
@ -98,7 +98,7 @@ class ScheduledTask extends Model {
|
|||||||
if (!is_null($this->meta) && !Helpers::isJson($this->meta)) {
|
if (!is_null($this->meta) && !Helpers::isJson($this->meta)) {
|
||||||
$this->set(
|
$this->set(
|
||||||
'meta',
|
'meta',
|
||||||
json_encode($this->meta)
|
(string)json_encode($this->meta)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
parent::save();
|
parent::save();
|
||||||
|
@ -84,7 +84,7 @@ class Segment extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function withSubscribersCount() {
|
public function withSubscribersCount() {
|
||||||
$this->subscribersCount = SubscriberSegment::tableAlias('relation')
|
$query = SubscriberSegment::tableAlias('relation')
|
||||||
->where('relation.segment_id', $this->id)
|
->where('relation.segment_id', $this->id)
|
||||||
->join(
|
->join(
|
||||||
MP_SUBSCRIBERS_TABLE,
|
MP_SUBSCRIBERS_TABLE,
|
||||||
@ -117,8 +117,11 @@ class Segment extends Model {
|
|||||||
Subscriber::STATUS_BOUNCED
|
Subscriber::STATUS_BOUNCED
|
||||||
)
|
)
|
||||||
->whereNull('subscribers.deleted_at')
|
->whereNull('subscribers.deleted_at')
|
||||||
->findOne()
|
->findOne();
|
||||||
->asArray();
|
|
||||||
|
if ($query instanceof SubscriberSegment) {
|
||||||
|
$this->subscribersCount = $query->asArray();
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user