Commit 6b097097 authored by Tiago Brito's avatar Tiago Brito Committed by Steve Müller

resolves #632 Fix null cast in boolean type in Postgres platform

parent affbce3f
...@@ -741,7 +741,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -741,7 +741,7 @@ class PostgreSqlPlatform extends AbstractPlatform
private function convertSingleBooleanValue($value, $callback) private function convertSingleBooleanValue($value, $callback)
{ {
if (null === $value) { if (null === $value) {
return $callback(false); return $callback(null);
} }
if (is_bool($value) || is_numeric($value)) { if (is_bool($value) || is_numeric($value)) {
...@@ -805,6 +805,9 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -805,6 +805,9 @@ class PostgreSqlPlatform extends AbstractPlatform
return $this->doConvertBooleans( return $this->doConvertBooleans(
$item, $item,
function ($boolean) { function ($boolean) {
if (is_null($boolean)) {
return 'NULL';
}
return true === $boolean ? 'true' : 'false'; return true === $boolean ? 'true' : 'false';
} }
); );
...@@ -822,7 +825,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -822,7 +825,7 @@ class PostgreSqlPlatform extends AbstractPlatform
return $this->doConvertBooleans( return $this->doConvertBooleans(
$item, $item,
function ($boolean) { function ($boolean) {
return (int) $boolean; return is_null($boolean) ? null : (int) $boolean;
} }
); );
} }
......
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