Exemplo 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;
 }
Exemplo n.º 2
0
 public function getEnv()
 {
     $env = parent::getEnv();
     $env['PGPASSWORD'] = $this->dsn['password'];
     return $env;
 }
Exemplo 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;
 }
Exemplo n.º 4
0
 public function __construct(Connection $connection, $config = [])
 {
     parent::__construct($connection, $config);
     $this->initDsn($connection);
 }
Exemplo n.º 5
0
 public function __construct(Connection $connection, $config = [])
 {
     parent::__construct($connection, $config);
 }