From e80b339d7fa4a5e50c16d0c74e0c2133b9aa6dfe Mon Sep 17 00:00:00 2001 From: zYne Date: Thu, 15 Feb 2007 11:36:43 +0000 Subject: [PATCH] boolean value parsing added --- lib/Doctrine/DataDict.php | 18 ++++++++++++++++++ lib/Doctrine/DataDict/Pgsql.php | 12 ++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/Doctrine/DataDict.php b/lib/Doctrine/DataDict.php index e52b61fb6..0875db928 100644 --- a/lib/Doctrine/DataDict.php +++ b/lib/Doctrine/DataDict.php @@ -73,4 +73,22 @@ class Doctrine_DataDict extends Doctrine_Connection_Module return $change; } + /** + * parseBoolean + * parses a literal boolean value and returns + * proper sql equivalent + * + * @param string $value boolean value to be parsed + * @return string parsed boolean value + */ + public function parseBoolean($value) + { + // parse booleans + if ($value == 'true') { + $value = 1; + } elseif ($value == 'false') { + $value = 0; + } + return $value; + } } diff --git a/lib/Doctrine/DataDict/Pgsql.php b/lib/Doctrine/DataDict/Pgsql.php index da89dc0e8..be220225b 100644 --- a/lib/Doctrine/DataDict/Pgsql.php +++ b/lib/Doctrine/DataDict/Pgsql.php @@ -602,4 +602,16 @@ class Doctrine_DataDict_Pgsql extends Doctrine_DataDict $name = $this->conn->quoteIdentifier($name, true); return $name . ' ' . $this->getNativeDeclaration($field) . $default . $notnull; } + /** + * parseBoolean + * parses a literal boolean value and returns + * proper sql equivalent + * + * @param string $value boolean value to be parsed + * @return string parsed boolean value + */ + public function parseBoolean($value) + { + return $value; + } }