Skip to content

Commit

Permalink
array columns getter: return correct value for [0] (#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan authored and marcj committed Nov 26, 2016
1 parent b1f8262 commit ea869c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Propel/Generator/Builder/Om/ObjectBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ protected function addArrayAccessorBody(&$script, Column $column)
}
if (!\$this->$cloUnserialized && null !== \$this->$clo) {
\$$cloUnserialized = substr(\$this->$clo, 2, -2);
\$this->$cloUnserialized = \$$cloUnserialized ? explode(' | ', \$$cloUnserialized) : array();
\$this->$cloUnserialized = '' !== \$$cloUnserialized ? explode(' | ', \$$cloUnserialized) : array();
}
return \$this->$cloUnserialized;";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ public function testSetterArrayValue()
$this->assertEquals($value, $e->getTags(), 'array columns can store arrays');
}

public function testGetterForArrayWithOnlyOneZeroValue()
{
$e = new ComplexColumnTypeEntity2();
$value = [0];
$e->setTags($value);
$this->assertEquals($value, $e->getTags());
}

public function testSetterResetValue()
{
$e = new ComplexColumnTypeEntity2();
Expand Down

0 comments on commit ea869c7

Please sign in to comment.