コード例 #1
0
ファイル: Migrations.php プロジェクト: lhas/pep
 /**
  * Sets the adapter the manager is going to need to operate on the DB
  * This will make sure the adapter instance is a \Migrations\CakeAdapter instance
  *
  * @return void
  */
 public function setAdapter()
 {
     if ($this->input !== null) {
         $connectionName = 'default';
         if ($this->input->getOption('connection')) {
             $connectionName = $this->input->getOption('connection');
         }
         $connection = ConnectionManager::get($connectionName);
         $env = $this->manager->getEnvironment('default');
         $adapter = $env->getAdapter();
         if (!$adapter instanceof CakeAdapter) {
             $env->setAdapter(new CakeAdapter($adapter, $connection));
         }
     }
 }