예제 #1
0
 /**
  * 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
 /**
  * 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
 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();
     }
 }