當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Index::getName方法代碼示例

本文整理匯總了PHP中Propel\Generator\Model\Index::getName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Index::getName方法的具體用法?PHP Index::getName怎麽用?PHP Index::getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Propel\Generator\Model\Index的用法示例。


在下文中一共展示了Index::getName方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testCreateDefaultIndexName

 /**
  * @dataProvider provideTableSpecificAttributes
  *
  */
 public function testCreateDefaultIndexName($tableName, $maxColumnNameLength, $indexName)
 {
     $table = $this->getTableMock($tableName, array('common_name' => $tableName, 'indices' => array(new Index(), new Index()), 'database' => $this->getDatabaseMock('bookstore', array('platform' => $this->getPlatformMock(true, array('max_column_name_length' => $maxColumnNameLength))))));
     $index = new Index();
     $index->setTable($table);
     $this->assertSame($indexName, $index->getName());
 }
開發者ID:robin850,項目名稱:Propel2,代碼行數:11,代碼來源:IndexTest.php

示例2: testCreateDefaultIndexName

 /**
  * @dataProvider provideTableSpecificAttributes
  *
  */
 public function testCreateDefaultIndexName($tableName, $maxColumnNameLength, $indexName)
 {
     $database = $this->getDatabaseMock('bookstore');
     $database->expects($this->any())->method('getMaxColumnNameLength')->will($this->returnValue($maxColumnNameLength));
     $table = $this->getTableMock($tableName, ['common_name' => $tableName, 'indices' => [new Index(), new Index()], 'database' => $database]);
     $index = new Index();
     $index->setTable($table);
     $this->assertSame($indexName, $index->getName());
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:13,代碼來源:IndexTest.php

示例3: getDropIndexDDL

 /**
  * Builds the DDL SQL to drop an Index.
  *
  * @param  Index  $index
  * @return string
  */
 public function getDropIndexDDL(Index $index)
 {
     $pattern = "\nDROP INDEX %s ON %s;\n";
     return sprintf($pattern, $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()));
 }
開發者ID:kalaspuffar,項目名稱:php-orm-benchmark,代碼行數:11,代碼來源:MysqlPlatform.php

示例4: getAddIndexDDL

 /**
  * Builds the DDL SQL to add an Index.
  *
  * @param  Index  $index
  * @return string
  */
 public function getAddIndexDDL(Index $index)
 {
     // don't create index form primary key
     if ($this->getPrimaryKeyName($index->getTable()) == $this->quoteIdentifier($index->getName())) {
         return '';
     }
     $pattern = "\nCREATE %sINDEX %s ON %s (%s)%s;\n";
     return sprintf($pattern, $index->isUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->quoteIdentifier($index->getTable()->getName()), $this->getColumnListDDL($index->getColumnObjects()), $this->generateBlockStorage($index));
 }
開發者ID:smoqs,項目名稱:Propel2,代碼行數:15,代碼來源:OraclePlatform.php

示例5: getDropIndexDDL

 /**
  * Overrides the implementation from DefaultPlatform
  *
  * @author     Niklas Närhinen <niklas@narhinen.net>
  * @return     string
  * @see        DefaultPlatform::getDropIndexDDL
  */
 public function getDropIndexDDL(Index $index)
 {
     if ($index instanceof Unique) {
         $pattern = "\n    ALTER TABLE %s DROP CONSTRAINT %s;\n    ";
         return sprintf($pattern, $this->quoteIdentifier($index->getTable()->getName()), $this->quoteIdentifier($index->getName()));
     } else {
         return parent::getDropIndexDDL($index);
     }
 }
開發者ID:RafalFilipek,項目名稱:Propel2,代碼行數:16,代碼來源:PgsqlPlatform.php

示例6: getIndexDDL

 /**
  * Builds the DDL SQL for an Index object.
  *
  * @param  Index  $index
  * @return string
  */
 public function getIndexDDL(Index $index)
 {
     return sprintf('%sINDEX %s (%s)', $index->isUnique() ? 'UNIQUE ' : '', $this->quoteIdentifier($index->getName()), $this->getColumnListDDL($index->getColumnObjects()));
 }
開發者ID:dracony,項目名稱:forked-php-orm-benchmark,代碼行數:10,代碼來源:DefaultPlatform.php

示例7: addIndex

 /**
  * Adds a new index to the indices list and set the
  * parent table of the column to the current table.
  *
  * @param  Index|array $index
  * @return Index
  *
  * @throw  InvalidArgumentException
  */
 public function addIndex($index)
 {
     if ($index instanceof Index) {
         if ($this->hasIndex($index->getName())) {
             throw new InvalidArgumentException(sprintf('Index "%s" already exist.', $index->getName()));
         }
         if (!$index->getColumns()) {
             throw new InvalidArgumentException(sprintf('Index "%s" has no columns.', $index->getName()));
         }
         $index->setTable($this);
         // force the name to be created if empty.
         $this->indices[] = $index;
         return $index;
     }
     $idx = new Index();
     $idx->loadMapping($index);
     foreach ((array) @$index['columns'] as $column) {
         $idx->addColumn($column);
     }
     return $this->addIndex($idx);
 }
開發者ID:disider,項目名稱:Propel2,代碼行數:30,代碼來源:Table.php

示例8: addIndex

 /**
  * Adds a new index to the indices list and set the
  * parent table of the column to the current table.
  *
  * @param  Index $index
  * @return Index
  */
 public function addIndex($index)
 {
     if ($index instanceof Index) {
         $index->setTable($this);
         // force the name to be created if empty.
         $index->getName();
         $this->indices[] = $index;
         return $index;
     }
     $idx = new Index();
     $idx->loadMapping($index);
     return $this->addIndex($idx);
 }
開發者ID:robin850,項目名稱:Propel2,代碼行數:20,代碼來源:Table.php

示例9: appendGenericIndexNode

 /**
  * Appends a generice <index> or <unique> XML node to its parent node.
  *
  * @param string   $nodeType   The node type (index or unique)
  * @param Index    $index      The Index model instance
  * @param \DOMNode $parentNode The parent DOMNode object
  */
 private function appendGenericIndexNode($nodeType, Index $index, \DOMNode $parentNode)
 {
     $indexNode = $parentNode->appendChild($this->document->createElement($nodeType));
     $indexNode->setAttribute('name', $index->getName());
     foreach ($index->getColumns() as $columnName) {
         $indexColumnNode = $indexNode->appendChild($this->document->createElement($nodeType . '-column'));
         $indexColumnNode->setAttribute('name', $columnName);
         if ($size = $index->getColumnSize($columnName)) {
             $indexColumnNode->setAttribute('size', $size);
         }
     }
     foreach ($index->getVendorInformation() as $vendorInformation) {
         $this->appendVendorInformationNode($vendorInformation, $indexNode);
     }
 }
開發者ID:SwissalpS,項目名稱:Propel2,代碼行數:22,代碼來源:XmlDumper.php


注:本文中的Propel\Generator\Model\Index::getName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。