Skip to content

Commit

Permalink
Update MailQueue.php
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey82k committed Feb 20, 2017
1 parent 7d50cd7 commit 65f97d4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MailQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ class MailQueue extends Mailer
public function init()
{
parent::init();

if (Yii::$app->db->getTableSchema($this->table) == null) {
throw new \yii\base\InvalidConfigException('"' . $this->table . '" not found in database. Make sure the db migration is properly done and the table is created.');
}
}

/**
Expand All @@ -85,10 +89,6 @@ public function init()
*/
public function process()
{
if (Yii::$app->db->getTableSchema($this->table) == null) {
throw new \yii\base\InvalidConfigException('"' . $this->table . '" not found in database. Make sure the db migration is properly done and the table is created.');
}

$success = true;

$items = Queue::find()->where(['and', ['sent_time' => NULL], ['<', 'attempts', $this->maxAttempts], ['<=', 'time_to_send', date('Y-m-d H:i:s')]])->orderBy(['created_at' => SORT_ASC])->limit($this->mailsPerRound);
Expand Down

0 comments on commit 65f97d4

Please sign in to comment.