Esempio n. 1
0
 /**
  * @inheritdoc
  */
 public function beforeAction($action)
 {
     if (!parent::beforeAction($action)) {
         return false;
     }
     $connection = Yii::$app->get($this->name);
     $driverName = Driver::driverName($connection);
     if (!isset($this->drivers[$driverName])) {
         throw new Exception(Yii::t('yii', 'Unknown database driver: {name}', ['name' => $driverName]));
     }
     $this->driver = Yii::createObject($this->drivers[$driverName], [$connection]);
     return true;
 }
Esempio n. 2
0
 public function getEnv()
 {
     $env = parent::getEnv();
     $env['PGPASSWORD'] = $this->dsn['password'];
     return $env;
 }
Esempio n. 3
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->dsn['host'] = isset($this->dsn['host']) ? $this->dsn['host'] : $this->host;
     $this->dsn['port'] = isset($this->dsn['port']) ? $this->dsn['port'] : $this->port;
 }
Esempio n. 4
0
 public function __construct(Connection $connection, $config = [])
 {
     parent::__construct($connection, $config);
     $this->initDsn($connection);
 }
Esempio n. 5
0
 public function __construct(Connection $connection, $config = [])
 {
     parent::__construct($connection, $config);
 }