From 65f97d49dab3dec53e0511b9507e50aa424c9b88 Mon Sep 17 00:00:00 2001 From: andrey82k Date: Mon, 20 Feb 2017 22:13:28 +0300 Subject: [PATCH] Update MailQueue.php --- MailQueue.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/MailQueue.php b/MailQueue.php index 4069fe3..7c1daae 100644 --- a/MailQueue.php +++ b/MailQueue.php @@ -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.'); + } } /** @@ -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);