本文整理汇总了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());
}
示例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());
}
示例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()));
}
示例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));
}
示例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);
}
}
示例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()));
}
示例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);
}
示例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);
}
示例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);
}
}