Commit 9b3ace24 authored by Steve Müller's avatar Steve Müller

Merge pull request #720 from TerjeBr/json_type-update

Type json_array is not consistent with NULL values
parents e3441215 4d99ed40
...@@ -54,7 +54,7 @@ class JsonArrayType extends Type ...@@ -54,7 +54,7 @@ class JsonArrayType extends Type
*/ */
public function convertToPHPValue($value, AbstractPlatform $platform) public function convertToPHPValue($value, AbstractPlatform $platform)
{ {
if ($value === null) { if ($value === null || $value === '') {
return array(); return array();
} }
......
...@@ -48,6 +48,11 @@ class JsonArrayTest extends \Doctrine\Tests\DbalTestCase ...@@ -48,6 +48,11 @@ class JsonArrayTest extends \Doctrine\Tests\DbalTestCase
$this->assertSame(array(), $this->type->convertToPHPValue(null, $this->platform)); $this->assertSame(array(), $this->type->convertToPHPValue(null, $this->platform));
} }
public function testJsonEmptyStringConvertsToPHPValue()
{
$this->assertSame(array(), $this->type->convertToPHPValue('', $this->platform));
}
public function testJsonStringConvertsToPHPValue() public function testJsonStringConvertsToPHPValue()
{ {
$value = array('foo' => 'bar', 'bar' => 'foo'); $value = array('foo' => 'bar', 'bar' => 'foo');
......
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