/** * Returns an array with all available tables that should be dumped. Those tables are pre-sorted according to * their dependencies to other tables. Furthermore, the identifiers of the tables are already quoted. * * @param DumperConfigurationInterface $config * * @return \Doctrine\DBAL\Schema\Table[] */ public function findTablesToDump(DumperConfigurationInterface $config) { $schemaManager = $this->connection->getSchemaManager(); $tables = $schemaManager->listTables(); $this->createMissingTableConfigs($config, $tables); $tables = $this->tableDependencyResolver->sortTablesByDependencies($tables); $this->tableDependencyResolver->createDependentFilters($tables, $config); $filter = new TableFilter($config); $tables = $filter->filterWhiteListTables($tables); $tables = $filter->filterIgnoredTables($tables); // Quote all identifiers, as Doctrine DBAL only quotes reserved keywords by default $tables = $this->identifierQuoter->quoteTables($tables); return $tables; }
/** * Tests whether a ignored table will be detected correctly. * * @test */ public function testIgnoredTables() { $ignoredTableConfig = new TableConfiguration('ignored'); $ignoredTableConfig->setIgnoreTable(); $config = new SqlDumperConfiguration(); $config->addTableConfig($ignoredTableConfig); $tableFilter = new TableFilter($config); $notIgnoredTable = new Table('not_ignored'); $ignoredTable = new Table('ignored'); $this->assertTrue($tableFilter->isTableNotIgnored($notIgnoredTable)); // not ignored, as not configured $this->assertFalse($tableFilter->isTableNotIgnored($ignoredTable)); // not ignored, as not configured $this->assertEquals(array($notIgnoredTable), $tableFilter->filterIgnoredTables(array($notIgnoredTable, $ignoredTable))); }