コード例 #1
0
ファイル: RedisQueue.php プロジェクト: Nuffic/yii2-queue
 /**
  * Class initialization logic
  *
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     $this->redis = Yii::$app->get($this->redis);
     if (!$this->redis instanceof Connection) {
         throw new InvalidConfigException("Queue::redis must be either a Redis connection instance or the application component ID of a Redis connection.");
     }
 }
コード例 #2
0
ファイル: RedisQueue.php プロジェクト: tsacks/yii2-queue
 /**
  * Class initialization logic
  *
  * @throws InvalidConfigException
  */
 public function init()
 {
     parent::init();
     if (is_string($this->redis)) {
         $this->redis = Yii::$app->get($this->redis);
     } elseif (is_array($this->redis)) {
         $this->redis = Yii::createObject($this->redis);
     }
     if (!$this->redis instanceof Connection) {
         throw new InvalidConfigException("Queue::redis must be either a Redis connection instance or the application component ID of a Redis connection.");
     }
 }
コード例 #3
0
ファイル: SqlQueue.php プロジェクト: wayhood/yii2-queue
 public function init()
 {
     parent::init();
     if (is_string($this->connection)) {
         $this->connection = Yii::$app->get($this->connection);
     } elseif (is_array($this->connection)) {
         if (!isset($this->connection['class'])) {
             $this->connection['class'] = Connection::className();
         }
         $this->connection = Yii::createObject($this->connection);
     }
     if (!$this->connection instanceof Connection) {
         throw new InvalidConfigException("Queue::connection must be application component ID of a SQL connection.");
     }
     if (!$this->hasTable()) {
         $this->createTable();
     }
 }