本文整理汇总了PHP中Doctrine\DBAL\Schema\Index::isUnique方法的典型用法代码示例。如果您正苦于以下问题:PHP Index::isUnique方法的具体用法?PHP Index::isUnique怎么用?PHP Index::isUnique使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Index
的用法示例。
在下文中一共展示了Index::isUnique方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAdvancedIndexOptionsSQL
/**
* {@inheritdoc}
*/
protected function getAdvancedIndexOptionsSQL(Index $index)
{
if ($index->hasFlag('with_nulls_distinct') && $index->hasFlag('with_nulls_not_distinct')) {
throw new UnexpectedValueException('An Index can either have a "with_nulls_distinct" or "with_nulls_not_distinct" flag but not both.');
}
if (!$index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_distinct')) {
return ' WITH NULLS DISTINCT' . parent::getAdvancedIndexOptionsSQL($index);
}
return parent::getAdvancedIndexOptionsSQL($index);
}
示例2: indexToArray
/**
* @param string $table
* @param \Doctrine\DBAL\Schema\Index $index
* @return array
*/
protected function indexToArray($table, $index)
{
if ($index->isPrimary()) {
$type = 'primary';
} elseif ($index->isUnique()) {
$type = 'unique';
} else {
$type = 'index';
}
$array = ['type' => $type, 'name' => null, 'columns' => $index->getColumns()];
if (!$this->isDefaultIndexName($table, $index->getName(), $type, $index->getColumns())) {
$array['name'] = $index->getName();
}
return $array;
}
示例3: indexToArray
/**
* @param string $table
* @param \Doctrine\DBAL\Schema\Index $index
* @return array
*/
protected function indexToArray($table, $index)
{
if ($index->isPrimary()) {
$type = 'primary';
} elseif ($index->isUnique()) {
$type = 'unique';
} else {
$type = 'index';
}
$array = ['type' => $type, 'name' => null, 'columns' => $index->getColumns()];
if (!$this->ignoreIndexNames and !$this->isDefaultIndexName($table, $index->getName(), $type, $index->getColumns())) {
// Sent Index name to exclude spaces
$array['name'] = str_replace(' ', '', $index->getName());
}
return $array;
}
示例4: getCreateIndexSQLFlags
/**
* {@inheritdoc}
*/
protected function getCreateIndexSQLFlags(Index $index)
{
$type = '';
if ($index->hasFlag('virtual')) {
$type .= 'VIRTUAL ';
}
if ($index->isUnique()) {
$type .= 'UNIQUE ';
}
if ($index->hasFlag('clustered')) {
$type .= 'CLUSTERED ';
}
return $type;
}
示例5: getCreateIndexSQLFlags
/**
* {@inheritDoc}
*/
protected function getCreateIndexSQLFlags(Index $index)
{
$type = '';
if ($index->isUnique()) {
$type .= 'UNIQUE ';
} elseif ($index->hasFlag('fulltext')) {
$type .= 'FULLTEXT ';
} elseif ($index->hasFlag('spatial')) {
$type .= 'SPATIAL ';
}
return $type;
}
示例6: overrules
/**
* Detect if the other index is a non-unique, non primary index that can be overwritten by this one.
*
* @param Index $other
* @return bool
*/
public function overrules(Index $other)
{
if ($other->isPrimary()) {
return false;
} else {
if ($this->isSimpleIndex() && $other->isUnique()) {
return false;
}
}
if ($this->spansColumns($other->getColumns()) && ($this->isPrimary() || $this->isUnique())) {
return true;
}
return false;
}
示例7: getCreateIndexSQLFlags
/**
* {@inheritDoc}
*/
protected function getCreateIndexSQLFlags(Index $index)
{
$type = '';
if ($index->isUnique()) {
$type .= 'UNIQUE ';
}
if ($index->hasFlag('clustered')) {
$type .= 'CLUSTERED ';
} elseif ($index->hasFlag('nonclustered')) {
$type .= 'NONCLUSTERED ';
}
return $type;
}
示例8: getIndexDeclarationSQL
/**
* Obtain DBMS specific SQL code portion needed to set an index
* declaration to be used in statements like CREATE TABLE.
*
* @param string $name name of the index
* @param Index $index index definition
* @return string DBMS specific SQL code portion needed to set an index
*/
public function getIndexDeclarationSQL($name, Index $index)
{
$type = '';
if ($index->isUnique()) {
$type = 'UNIQUE ';
}
if (count($index->getColumns()) == 0) {
throw \InvalidArgumentException("Incomplete definition. 'columns' required.");
}
return $type . 'INDEX ' . $name . ' (' . $this->getIndexFieldDeclarationListSQL($index->getColumns()) . ')';
}
示例9: getCreateIndexSQLFlags
/**
* Adds additional flags for index generation.
*
* @param \Doctrine\DBAL\Schema\Index $index
*
* @return string
*/
protected function getCreateIndexSQLFlags(Index $index)
{
return $index->isUnique() ? 'UNIQUE ' : '';
}
示例10: getAdvancedIndexOptionsSQL
/**
* {@inheritdoc}
*/
protected function getAdvancedIndexOptionsSQL(Index $index)
{
if (!$index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_not_distinct')) {
return ' WITH NULLS NOT DISTINCT' . parent::getAdvancedIndexOptionsSQL($index);
}
return parent::getAdvancedIndexOptionsSQL($index);
}
示例11: saveIndex
/**
* @param Index $index
* @param \SimpleXMLElement $xml
*/
private static function saveIndex($index, $xml)
{
$xml->addChild('name', $index->getName());
if ($index->isPrimary()) {
$xml->addChild('primary', 'true');
} elseif ($index->isUnique()) {
$xml->addChild('unique', 'true');
}
foreach ($index->getColumns() as $column) {
$field = $xml->addChild('field');
$field->addChild('name', $column);
$field->addChild('sorting', 'ascending');
}
}
示例12: createIndexReplacement
/**
* Creates a index replacement, which has quoted names.
*
* @param Index $index
*
* @return Index
*/
private function createIndexReplacement(Index $index)
{
return new Index($this->platform->quoteIdentifier($index->getName()), $this->quoteIdentifiers($index->getColumns()), $index->isUnique(), $index->isPrimary(), $index->getFlags(), $index->getOptions());
}
示例13: acceptIndex
/**
* Accept an index on in a table
*
* @param Table $table a table object
* @param Index $index a column object
*
* @return void
*/
public function acceptIndex(Table $table, Index $index)
{
$this->schemaArray['tables'][$table->getName()]['indexes'][$index->getName()] = array('name' => $index->getName(), 'columns' => $index->getColumns(), 'unique' => $index->isUnique(), 'primary' => $index->isPrimary());
}