Skip to content

Commit

Permalink
Merge pull request #472 from deeky666/fix-index-flags
Browse files Browse the repository at this point in the history
Fix index flags
  • Loading branch information
beberlei committed Dec 28, 2013
2 parents 2196da9 + 1f72848 commit d473423
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Schema/Index.php
Expand Up @@ -259,7 +259,7 @@ public function getFlags()
*/
public function addFlag($flag)
{
$this->flags[strtolower($flag)] = true;
$this->_flags[strtolower($flag)] = true;

return $this;
}
Expand All @@ -273,7 +273,7 @@ public function addFlag($flag)
*/
public function hasFlag($flag)
{
return isset($this->flags[strtolower($flag)]);
return isset($this->_flags[strtolower($flag)]);
}

/**
Expand All @@ -285,6 +285,6 @@ public function hasFlag($flag)
*/
public function removeFlag($flag)
{
unset($this->flags[strtolower($flag)]);
unset($this->_flags[strtolower($flag)]);
}
}
3 changes: 3 additions & 0 deletions tests/Doctrine/Tests/DBAL/Schema/IndexTest.php
Expand Up @@ -89,13 +89,16 @@ public function testFlags()
{
$idx1 = $this->createIndex();
$this->assertFalse($idx1->hasFlag('clustered'));
$this->assertEmpty($idx1->getFlags());

$idx1->addFlag('clustered');
$this->assertTrue($idx1->hasFlag('clustered'));
$this->assertTrue($idx1->hasFlag('CLUSTERED'));
$this->assertSame(array('clustered'), $idx1->getFlags());

$idx1->removeFlag('clustered');
$this->assertFalse($idx1->hasFlag('clustered'));
$this->assertEmpty($idx1->getFlags());
}

/**
Expand Down

0 comments on commit d473423

Please sign in to comment.