當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。