Commit dd708ce9 authored by Benjamin Eberlei's avatar Benjamin Eberlei

DBAL-64 - More identifier quoting madness. Why am i responsible for this?

parent 135e657a
...@@ -51,9 +51,15 @@ abstract class AbstractAsset ...@@ -51,9 +51,15 @@ abstract class AbstractAsset
*/ */
protected function _setName($name) protected function _setName($name)
{ {
if (strlen($name) && $name[0] == '`') { if (strlen($name)) {
// TODO: find more elegant way to solve this issue.
if ($name[0] == '`') {
$this->_quoted = true; $this->_quoted = true;
$name = trim($name, '`'); $name = trim($name, '`');
} else if ($name[0] == '"') {
$this->_quoted = true;
$name = trim($name, '"');
}
} }
$this->_name = $name; $this->_name = $name;
} }
......
...@@ -63,7 +63,7 @@ class Index extends AbstractAsset implements Constraint ...@@ -63,7 +63,7 @@ class Index extends AbstractAsset implements Constraint
protected function _addColumn($column) protected function _addColumn($column)
{ {
if(is_string($column)) { if(is_string($column)) {
$this->_columns[] = strtolower($column); $this->_columns[] = $column;
} else { } else {
throw new \InvalidArgumentException("Expecting a string as Index Column"); throw new \InvalidArgumentException("Expecting a string as Index Column");
} }
......
...@@ -326,7 +326,8 @@ class TableTest extends \PHPUnit_Framework_TestCase ...@@ -326,7 +326,8 @@ class TableTest extends \PHPUnit_Framework_TestCase
$table->addIndex(array("ID"), "my_idx"); $table->addIndex(array("ID"), "my_idx");
$this->assertTrue($table->hasIndex('my_idx')); $this->assertTrue($table->hasIndex('my_idx'));
$this->assertEquals(array("id"), $table->getIndex("my_idx")->getColumns()); $this->assertEquals(array("ID"), $table->getIndex("my_idx")->getColumns());
$this->assertTrue($table->getIndex('my_idx')->spansColumns(array('id')));
} }
public function testAddPrimaryKey_ColumnsAreExplicitlySetToNotNull() public function testAddPrimaryKey_ColumnsAreExplicitlySetToNotNull()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment