From 08d638eda3792eb7ebd0f2f9a73fdf06a9ec59f4 Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 2 Jan 2007 19:33:22 +0000 Subject: [PATCH] --- lib/Doctrine/Query/Condition.php | 38 +++++++++++++++++++++++++---- lib/Doctrine/Query/Exception.php | 33 +++++++++++++++++++++++-- lib/Doctrine/Query/Groupby.php | 41 +++++++++++++++++++++++++++----- lib/Doctrine/Query/Having.php | 33 +++++++++++++++++++++++-- lib/Doctrine/Query/Set.php | 1 + lib/Doctrine/Query/Where.php | 33 +++++++++++++++++++++++-- 6 files changed, 162 insertions(+), 17 deletions(-) diff --git a/lib/Doctrine/Query/Condition.php b/lib/Doctrine/Query/Condition.php index 9c04fc6f4..57a28db4c 100644 --- a/lib/Doctrine/Query/Condition.php +++ b/lib/Doctrine/Query/Condition.php @@ -1,12 +1,40 @@ . + */ +Doctrine::autoload('Doctrine_Query_Part'); +/** + * Doctrine_Query_Condition + * + * @package Doctrine + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + * @author Konsta Vesterinen + */ abstract class Doctrine_Query_Condition extends Doctrine_Query_Part { /** * DQL CONDITION PARSER - * parses the where/having part of the query string - * + * parses the join condition/where/having part of the query string * * @param string $str * @return string @@ -33,7 +61,7 @@ abstract class Doctrine_Query_Condition extends Doctrine_Query_Part $part = Doctrine_Query::bracketTrim($part, '(', ')'); $ret[] = $this->parse($part); } - $r = implode(' OR ',$ret); + $r = implode(' OR ', $ret); } else { if (substr($parts[0],0,1) == '(' && substr($parts[0],-1) == ')') { return $this->parse(substr($parts[0],1,-1)); diff --git a/lib/Doctrine/Query/Exception.php b/lib/Doctrine/Query/Exception.php index 8853ddd58..23f713c1a 100644 --- a/lib/Doctrine/Query/Exception.php +++ b/lib/Doctrine/Query/Exception.php @@ -1,5 +1,34 @@ . + */ +Doctrine::autoload('Doctrine_Exception'); +/** + * Doctrine_Query_Exception + * + * @package Doctrine + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + * @author Konsta Vesterinen + */ class Doctrine_Query_Exception extends Doctrine_Exception { } diff --git a/lib/Doctrine/Query/Groupby.php b/lib/Doctrine/Query/Groupby.php index 11787cdf0..5ed7e77cb 100644 --- a/lib/Doctrine/Query/Groupby.php +++ b/lib/Doctrine/Query/Groupby.php @@ -1,6 +1,35 @@ . + */ +Doctrine::autoload('Doctrine_Query_Part'); +/** + * Doctrine_Query_Groupby + * + * @package Doctrine + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + * @author Konsta Vesterinen + */ class Doctrine_Query_Groupby extends Doctrine_Query_Part { /** @@ -13,16 +42,16 @@ class Doctrine_Query_Groupby extends Doctrine_Query_Part final public function parse($str) { $r = array(); - foreach (explode(",", $str) as $reference) { + foreach (explode(',', $str) as $reference) { $reference = trim($reference); - $e = explode(".",$reference); + $e = explode('.', $reference); $field = array_pop($e); - $ref = implode(".", $e); + $ref = implode('.', $e); $table = $this->query->load($ref); $component = $table->getComponentName(); $r[] = $this->query->getTableAlias($ref).".".$field; } - return implode(", ", $r); + return implode(', ', $r); } public function __toString() diff --git a/lib/Doctrine/Query/Having.php b/lib/Doctrine/Query/Having.php index 6c6e462df..781e67900 100644 --- a/lib/Doctrine/Query/Having.php +++ b/lib/Doctrine/Query/Having.php @@ -1,6 +1,35 @@ . + */ +Doctrine::autoload('Doctrine_Query_Condition'); +/** + * Doctrine_Query_Having + * + * @package Doctrine + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + * @author Konsta Vesterinen + */ class Doctrine_Query_Having extends Doctrine_Query_Condition { /** diff --git a/lib/Doctrine/Query/Set.php b/lib/Doctrine/Query/Set.php index dfec04206..b4ce0a3fa 100644 --- a/lib/Doctrine/Query/Set.php +++ b/lib/Doctrine/Query/Set.php @@ -18,6 +18,7 @@ * and is licensed under the LGPL. For more information, see * . */ +Doctrine::autoload('Doctrine_Query_Part'); /** * Doctrine_Query * diff --git a/lib/Doctrine/Query/Where.php b/lib/Doctrine/Query/Where.php index e79b9f219..7e4ed5c96 100644 --- a/lib/Doctrine/Query/Where.php +++ b/lib/Doctrine/Query/Where.php @@ -1,6 +1,35 @@ . + */ +Doctrine::autoload('Doctrine_Query_Condition'); +/** + * Doctrine_Query_Where + * + * @package Doctrine + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + * @author Konsta Vesterinen + */ class Doctrine_Query_Where extends Doctrine_Query_Condition { /**