/** * @param Config $config * @param Connection $db * @param OutputInterface $output * @throws \Doctrine\DBAL\DBALException */ public function dump(Config $config, Connection $db, OutputInterface $output) { $dumper = new Dumper($output); $dumper->exportAsUTF8(); $dumper->disableForeignKeys(); $platform = $db->getDatabasePlatform(); $fetchTablesResult = $db->query($platform->getListTablesSQL()); while ($tableName = $fetchTablesResult->fetchColumn(0)) { $tableConfig = $config->findTable($tableName); if (null === $tableConfig) { continue; } if ($tableConfig->isSchemaDumpRequired()) { $dumper->dumpSchema($tableName, $db, $tableConfig->keepAutoIncrement()); if ($tableConfig->isDataDumpRequired()) { $dumper->dumpData($tableName, $tableConfig, $db); } } } $dumper->enableForeignKeys(); }
/** * @param string $columnName * * @return Column */ private function findColumn($columnName) { return Config::findBySelector($this->columns, $columnName); }
/** * Merge two configurations together. * If two configurations specify the same table, * the last one wins. * * @param Config $other */ public function merge(Config $other) { $this->tables = array_merge($this->tables, $other->getTables()); }