当前位置: 首页>>代码示例>>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;未经允许,请勿转载。