public function testGetTableNames() { $expected = array('article', 'article2tag', 'author', 'comment', 'data_types', 'donation', 'tag', 'tree_node', 'unique_constraint_test', 'user'); $actual = $this->schema->getTableNames(); sort($actual); $this->assertEquals($expected, $actual); }
public function initSchema() { $driver = $this->conn->getDriver(); // (re)create tables $tableNames = $this->schema->getTableNames(); $this->conn->disableForeignKeys(); foreach ($tableNames as $tableName) { $this->dropTable($driver, $tableName); $this->createTable($driver, $tableName); } $this->conn->enableForeignKeys(); // (re)create views $viewNames = $this->schema->getViewNames(); $platform = $driver->getPlatform(); foreach ($viewNames as $viewName) { $this->dropView($platform, $viewName); $this->createView($platform, $viewName); } }
/** * @param string $modelClassName * @param Schema $schema * @return string */ private function getTableName($modelClassName, Schema $schema) { $tableNames = $schema->getTableNames(); foreach ($tableNames as $tableName) { if ($modelClassName == $schema->getRecordClass($tableName)) { return $tableName; } } return null; }