Exemple #1
0
 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);
 }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
 /**
  * @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;
 }