/** * @param InputInterface $input * @param OutputInterface $output * @return int */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('This program comes with ABSOLUTELY NO WARRANTY.'); $mysql = new Mysql(new String(), new DateTime(), new Null(), $this->getConfig($input, $this->getAppEtcConfig())); $mysql->setOutput($output); $class = 'SchumacherFM\\Migrate\\' . $this->_migratorClass; /** @var MigratorInterface $m */ $m = new $class($output, $mysql, $input->getOption('prefix')); if (false === $m instanceof MigratorInterface) { throw new \InvalidArgumentException(get_class($m) . ' must implement MigratorInterface'); } return $m->migrate(); }
/** * via call_user_func_array ... * * @param $tableName * @param $idCol * @param $renameCol * @param $subPath */ public function renameModelsInTables($tableName, $idCol, $renameCol, $subPath) { foreach ($this->db->fetchAll('SELECT `' . $idCol . '`,`' . $renameCol . '` FROM `' . $tableName . '` WHERE `' . $renameCol . '` like \'%/%\'') as $row) { $this->db->update($tableName, [$renameCol => $this->renameModel($row[$renameCol], $subPath)], [$idCol . ' = ?' => $row[$idCol]]); } }