本文整理匯總了PHP中Doctrine\DBAL\Schema\Index::overrules方法的典型用法代碼示例。如果您正苦於以下問題:PHP Index::overrules方法的具體用法?PHP Index::overrules怎麽用?PHP Index::overrules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\DBAL\Schema\Index
的用法示例。
在下文中一共展示了Index::overrules方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testOverrulesWithPartial
public function testOverrulesWithPartial()
{
$without = new Index('without', array('col1', 'col2'), true, false, array(), array());
$partial = new Index('partial', array('col1', 'col2'), true, false, array(), array('where' => 'col1 IS NULL'));
$another = new Index('another', array('col1', 'col2'), true, false, array(), array('where' => 'col1 IS NULL'));
$this->assertFalse($partial->overrules($without));
$this->assertFalse($without->overrules($partial));
$this->assertTrue($partial->overrules($partial));
$this->assertTrue($partial->overrules($another));
$this->assertTrue($another->overrules($partial));
}
示例2: _addIndex
/**
* Add index to table
*
* @param Index $indexCandidate
* @return Table
*/
protected function _addIndex(Index $indexCandidate)
{
// check for duplicates
foreach ($this->_indexes as $existingIndex) {
if ($indexCandidate->isFullfilledBy($existingIndex)) {
return $this;
}
}
$indexName = $indexCandidate->getName();
$indexName = strtolower($indexName);
if (isset($this->_indexes[$indexName]) || $this->_primaryKeyName != false && $indexCandidate->isPrimary()) {
throw SchemaException::indexAlreadyExists($indexName, $this->_name);
}
// remove overruled indexes
foreach ($this->_indexes as $idxKey => $existingIndex) {
if ($indexCandidate->overrules($existingIndex)) {
unset($this->_indexes[$idxKey]);
}
}
if ($indexCandidate->isPrimary()) {
$this->_primaryKeyName = $indexName;
}
$this->_indexes[$indexName] = $indexCandidate;
return $this;
}