diff --git a/lib/Doctrine/Connection.php b/lib/Doctrine/Connection.php index 2ec036f5e..af8379968 100644 --- a/lib/Doctrine/Connection.php +++ b/lib/Doctrine/Connection.php @@ -219,14 +219,18 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun * @param array $item * @return void */ - public function convertBooleans(array $items) + public function convertBooleans($item) { - foreach ($items as $k => $item) { - if (is_bool($item)) { - $items[$k] = (int) $item; + if (is_array($item)) { + foreach ($item as $k => $value) { + if (is_bool($item)) { + $item[$k] = (int) $value; + } } + } else { + $item = (int) $item; } - return $items; + return $item; } /** * Quote a string so it can be safely used as a table or column name diff --git a/lib/Doctrine/Connection/Pgsql.php b/lib/Doctrine/Connection/Pgsql.php index 28ac9bcdc..bc8fe291e 100644 --- a/lib/Doctrine/Connection/Pgsql.php +++ b/lib/Doctrine/Connection/Pgsql.php @@ -99,9 +99,16 @@ class Doctrine_Connection_Pgsql extends Doctrine_Connection_Common * @param array $item * @return void */ - public function convertBooleans(array $items) + public function convertBooleans($item) { - return $items; + if (is_array($item)) { + foreach ($item as $key => $value) { + $item[$key] = ($value) ? 'true' : 'false'; + } + } else { + $item = ($item) ? 'true' : 'false'; + } + return $item; } /** * Changes a query string for various DBMS specific reasons