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


PHP AbstractSchemaManager::listTableIndexes方法代码示例

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


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

示例1: testDropAndCreateIndex

 public function testDropAndCreateIndex()
 {
     $table = $this->getTestTable('test_create_index');
     $table->addUniqueIndex(array('test'), 'test');
     $this->_sm->dropAndCreateTable($table);
     $this->_sm->dropAndCreateIndex($table->getIndex('test'), $table);
     $tableIndexes = $this->_sm->listTableIndexes('test_create_index');
     $this->assertType('array', $tableIndexes);
     $this->assertEquals('test', strtolower($tableIndexes['test']->getName()));
     $this->assertEquals(array('test'), array_map('strtolower', $tableIndexes['test']->getColumns()));
     $this->assertTrue($tableIndexes['test']->isUnique());
     $this->assertFalse($tableIndexes['test']->isPrimary());
 }
开发者ID:andreia,项目名称:doctrine,代码行数:13,代码来源:SchemaManagerFunctionalTestCase.php

示例2: getIndexes

 /**
  * Get table indexes.
  *
  * Get table indexes
  * @param string $table
  * @return array
  */
 public function getIndexes($table)
 {
     $indexes = ['unique' => [], 'index' => []];
     foreach ($this->schema->listTableIndexes($table) as $indexName => $index) {
         if ('primary' != $indexName) {
             $columns = $index->getColumns();
             $unique = $index->isUnique();
             $addKey = $unique ? 'unique' : 'index';
             $isForeign = $this->isIndexForeign($columns, $table);
             $generatedIndexName = $this->generateIndexName($table, $columns, $unique, $isForeign);
             $columns = count($columns) == 1 ? reset($columns) : $columns;
             if ($indexName == $generatedIndexName) {
                 $indexes[$addKey][] = $columns;
             } else {
                 $indexes[$addKey][$indexName] = $columns;
             }
         }
     }
     return $indexes;
 }
开发者ID:bebnev,项目名称:laravel-schema-parser,代码行数:27,代码来源:SchemaAdapter.php

示例3: testListTableIndexes

 public function testListTableIndexes()
 {
     $indexes = $this->sm->listTableIndexes('points');
     $spatialIndexes = array('idx_27ba8e293be136c3', 'idx_27ba8e295f51a43c', 'idx_27ba8e295afbb72d', 'idx_27ba8e29b7a5f324', 'idx_27ba8e293c257075', 'idx_27ba8e2999674a3d', 'idx_27ba8e29cf3dedbb', 'idx_27ba8e29cf3dedbb', 'idx_27ba8e293d5fe69e', 'idx_27ba8e29b832b304');
     $nonSpatialIndexes = array('idx_text', 'idx_text_gist');
     foreach ($spatialIndexes as $spatialIndex) {
         $this->assertArrayHasKey($spatialIndex, $indexes);
         $this->assertTrue($indexes[$spatialIndex]->hasFlag('SPATIAL'));
     }
     foreach ($nonSpatialIndexes as $nonSpatialIndex) {
         $this->assertArrayHasKey($nonSpatialIndex, $indexes);
         $this->assertFalse($indexes[$nonSpatialIndex]->hasFlag('SPATIAL'));
     }
 }
开发者ID:novikovsergey,项目名称:doctrine-postgis,代码行数:14,代码来源:DBALSchemaEventSubscriberTest.php

示例4: __construct

 /**
  * @param string                                      $table Table Name
  * @param \Doctrine\DBAL\Schema\AbstractSchemaManager $schema
  * @param bool                                        $ignoreIndexNames
  */
 public function __construct($table, $schema)
 {
     $this->indexes = array();
     $this->multiFieldIndexes = array();
     $indexes = $schema->listTableIndexes($table);
     foreach ($indexes as $index) {
         $indexArray = $this->indexToArray($table, $index);
         if (count($indexArray['columns']) == 1) {
             $columnName = $indexArray['columns'][0];
             $this->indexes[$columnName] = (object) $indexArray;
         } else {
             $this->multiFieldIndexes[] = (object) $indexArray;
         }
     }
 }
开发者ID:19peaches,项目名称:laravel-generator,代码行数:20,代码来源:IndexParser.php

示例5: checkPivots

 /**
  * return the the interesect on primary index and foreign key.
  * if we have 2 primary key that are also foreign key without a type field it should be a pivot table !
  *
  * @param $table
  * @return array
  */
 public function checkPivots($table)
 {
     $foreignKeys = $this->schema->listTableForeignKeys($table);
     $indexes = $this->schema->listTableIndexes($table);
     $toto = [];
     foreach ($foreignKeys as $key) {
         $toto[] = $key->getLocalColumns();
     }
     $tata = [];
     foreach ($indexes as $key) {
         if ($key->isPrimary()) {
             $tata[] = $key->getColumns();
         }
     }
     return array_intersect(array_flatten($toto), array_flatten($tata));
 }
开发者ID:Goopil,项目名称:laravel-generator,代码行数:23,代码来源:SchemaParser.php

示例6: testDoesNotListIndexesImplicitlyCreatedByForeignKeys

 /**
  * @group DBAL-1095
  */
 public function testDoesNotListIndexesImplicitlyCreatedByForeignKeys()
 {
     if (!$this->_sm->getDatabasePlatform()->supportsForeignKeyConstraints()) {
         $this->markTestSkipped('This test is only supported on platforms that have foreign keys.');
     }
     $primaryTable = new Table('test_list_index_implicit_primary');
     $primaryTable->addColumn('id', 'integer');
     $primaryTable->setPrimaryKey(array('id'));
     $foreignTable = new Table('test_list_index_implicit_foreign');
     $foreignTable->addColumn('fk1', 'integer');
     $foreignTable->addColumn('fk2', 'integer');
     $foreignTable->addIndex(array('fk1'), 'explicit_fk1_idx');
     $foreignTable->addForeignKeyConstraint('test_list_index_implicit_primary', array('fk1'), array('id'));
     $foreignTable->addForeignKeyConstraint('test_list_index_implicit_primary', array('fk2'), array('id'));
     $this->_sm->dropAndCreateTable($primaryTable);
     $this->_sm->dropAndCreateTable($foreignTable);
     $indexes = $this->_sm->listTableIndexes('test_list_index_implicit_foreign');
     $this->assertCount(2, $indexes);
     $this->assertArrayHasKey('explicit_fk1_idx', $indexes);
     $this->assertArrayHasKey('idx_6d88c7b4fdc58d6c', $indexes);
 }
开发者ID:selimcr,项目名称:servigases,代码行数:24,代码来源:SchemaManagerFunctionalTestCase.php

示例7: listTableIndexes

 /**
  * {@see AbstractSchemaManager::listTableIndexes}
  */
 public function listTableIndexes($table)
 {
     return $this->manager->listTableIndexes($this->replacePrefix($table));
 }
开发者ID:enyaku,项目名称:myGoogleMapsApiV3Test,代码行数:7,代码来源:Utility.php

示例8: listIndexes

 /**
  * @return  array
  */
 private function listIndexes()
 {
     return $this->schema->listTableIndexes($this->table);
 }
开发者ID:drwrf,项目名称:mismatch-orm,代码行数:7,代码来源:Populator.php


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