/** * 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)); } } }