当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractSchemaManager::listTableNames方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\Schema\AbstractSchemaManager::listTableNames方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractSchemaManager::listTableNames方法的具体用法?PHP AbstractSchemaManager::listTableNames怎么用?PHP AbstractSchemaManager::listTableNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\Schema\AbstractSchemaManager的用法示例。


在下文中一共展示了AbstractSchemaManager::listTableNames方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: reverseEngineerMappingFromDatabase

 private function reverseEngineerMappingFromDatabase()
 {
     if ($this->tables !== null) {
         return;
     }
     foreach ($this->_sm->listTableNames() as $tableName) {
         $tables[strtolower($tableName)] = $this->_sm->listTableDetails($tableName);
     }
     $this->tables = array();
     foreach ($tables as $name => $table) {
         /* @var $table Table */
         if ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) {
             $foreignKeys = $table->getForeignKeys();
         } else {
             $foreignKeys = array();
         }
         $allForeignKeyColumns = array();
         foreach ($foreignKeys as $foreignKey) {
             $allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
         }
         $pkColumns = $table->getPrimaryKey()->getColumns();
         sort($pkColumns);
         sort($allForeignKeyColumns);
         if ($pkColumns == $allForeignKeyColumns) {
             if (count($table->getForeignKeys()) > 2) {
                 throw new \InvalidArgumentException("ManyToMany table '" . $name . "' with more or less than two foreign keys are not supported by the Database Reverese Engineering Driver.");
             }
             $this->manyToManyTables[$name] = $table;
         } else {
             $className = Inflector::classify($name);
             $this->tables[$name] = $table;
             $this->classes[$className] = $name;
         }
     }
 }
开发者ID:skoop,项目名称:symfony-sandbox,代码行数:35,代码来源:DatabaseDriver.php

示例2: reverseEngineerMappingFromDatabase

 private function reverseEngineerMappingFromDatabase()
 {
     if ($this->tables !== null) {
         return;
     }
     foreach ($this->_sm->listTableNames() as $tableName) {
         $tables[$tableName] = $this->_sm->listTableDetails($tableName);
     }
     $this->tables = $this->manyToManyTables = $this->classToTableNames = array();
     foreach ($tables as $tableName => $table) {
         /* @var $table Table */
         if ($this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) {
             $foreignKeys = $table->getForeignKeys();
         } else {
             $foreignKeys = array();
         }
         $allForeignKeyColumns = array();
         foreach ($foreignKeys as $foreignKey) {
             $allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
         }
         $pkColumns = $table->getPrimaryKey()->getColumns();
         sort($pkColumns);
         sort($allForeignKeyColumns);
         if ($pkColumns == $allForeignKeyColumns && count($foreignKeys) == 2) {
             $this->manyToManyTables[$tableName] = $table;
         } else {
             // lower-casing is necessary because of Oracle Uppercase Tablenames,
             // assumption is lower-case + underscore separated.
             $className = Inflector::classify(strtolower($tableName));
             $this->tables[$tableName] = $table;
             $this->classToTableNames[$className] = $tableName;
         }
     }
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:34,代码来源:DatabaseDriver.php

示例3: reverseEngineerMappingFromDatabase

 /**
  * @return void
  *
  * @throws \Doctrine\ORM\Mapping\MappingException
  */
 private function reverseEngineerMappingFromDatabase()
 {
     if ($this->tables !== null) {
         return;
     }
     $tables = array();
     foreach ($this->_sm->listTableNames() as $tableName) {
         $tables[$tableName] = $this->_sm->listTableDetails($tableName);
     }
     $this->tables = $this->manyToManyTables = $this->classToTableNames = array();
     foreach ($tables as $tableName => $table) {
         $foreignKeys = $this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints() ? $table->getForeignKeys() : array();
         $allForeignKeyColumns = array();
         foreach ($foreignKeys as $foreignKey) {
             $allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
         }
         if (!$table->hasPrimaryKey()) {
             throw new MappingException("Table " . $table->getName() . " has no primary key. Doctrine does not " . "support reverse engineering from tables that don't have a primary key.");
         }
         $pkColumns = $table->getPrimaryKey()->getColumns();
         sort($pkColumns);
         sort($allForeignKeyColumns);
         if ($pkColumns == $allForeignKeyColumns && count($foreignKeys) == 2) {
             $this->manyToManyTables[$tableName] = $table;
         } else {
             // lower-casing is necessary because of Oracle Uppercase Tablenames,
             // assumption is lower-case + underscore separated.
             $className = $this->getClassNameForTable($tableName);
             $this->tables[$tableName] = $table;
             $this->classToTableNames[$className] = $tableName;
         }
     }
 }
开发者ID:rolas123,项目名称:weather-homework,代码行数:38,代码来源:DatabaseDriver.php

示例4: getTables

 /**
  * @return mixed
  */
 public function getTables()
 {
     return $this->schema->listTableNames();
 }
开发者ID:xethron,项目名称:migrations-generator,代码行数:7,代码来源:SchemaGenerator.php

示例5: tearDown

 public function tearDown()
 {
     foreach ($this->_sm->listTableNames() as $tableName) {
         $this->_sm->dropTable($tableName);
     }
 }
开发者ID:crate,项目名称:crate-dbal,代码行数:6,代码来源:SchemaManagerTest.php


注:本文中的Doctrine\DBAL\Schema\AbstractSchemaManager::listTableNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。