Define default variable values in cases when they can be undefined

This commit is contained in:
Tautvidas Sipavičius
2019-01-23 21:29:46 +02:00
parent 3bfba7c642
commit 44bc27df90
6 changed files with 16 additions and 5 deletions

View File

@@ -147,7 +147,7 @@ class Scheduler {
}
static function createPostNotificationSendingTask($newsletter) {
$existing_notification_history = Newsletter::table_alias('newsletters')
$existing_notification_history = Newsletter::tableAlias('newsletters')
->where('newsletters.parent_id', $newsletter->id)
->where('newsletters.type', Newsletter::TYPE_NOTIFICATION_HISTORY)
->where('newsletters.status', Newsletter::STATUS_SENDING)
@@ -194,9 +194,6 @@ class Scheduler {
$newsletter->nthWeekDay :
'#' . $newsletter->nthWeekDay;
switch($interval_type) {
case self::INTERVAL_IMMEDIATELY:
$schedule = '* * * * *';
break;
case self::INTERVAL_IMMEDIATE:
case self::INTERVAL_DAILY:
$schedule = sprintf('0 %s * * *', $hour);
@@ -210,6 +207,10 @@ class Scheduler {
case self::INTERVAL_MONTHLY:
$schedule = sprintf('0 %s %s * *', $hour, $month_day);
break;
case self::INTERVAL_IMMEDIATELY:
default:
$schedule = '* * * * *';
break;
}
$option_field = NewsletterOptionField::where('name', 'schedule')->findOne();
$relation = NewsletterOption::where('newsletter_id', $newsletter->id)