summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/TActiveRecordCriteria.php
diff options
context:
space:
mode:
authorwei <>2007-02-27 23:27:14 +0000
committerwei <>2007-02-27 23:27:14 +0000
commit4c86659bc90d9134b0f901572c5417aa7d9cec18 (patch)
tree41628a361f9d787d6d906f50a7bcf04682e98907 /framework/Data/ActiveRecord/TActiveRecordCriteria.php
parent61e14dd70fb045ac84caf92e688cd3b29b663f3f (diff)
Add comments for scaffold, minor changes to TActiveRecord
Diffstat (limited to 'framework/Data/ActiveRecord/TActiveRecordCriteria.php')
-rw-r--r--framework/Data/ActiveRecord/TActiveRecordCriteria.php27
1 files changed, 21 insertions, 6 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecordCriteria.php b/framework/Data/ActiveRecord/TActiveRecordCriteria.php
index 6adfe4ce..533ff50a 100644
--- a/framework/Data/ActiveRecord/TActiveRecordCriteria.php
+++ b/framework/Data/ActiveRecord/TActiveRecordCriteria.php
@@ -149,14 +149,29 @@ class TActiveRecordCriteria extends TComponent
$this->_offset=$value;
}
+ /**
+ * @return string string representation of the criteria. Useful for debugging.
+ */
public function __toString()
{
- return $this->getCondition();
- }
-
- public function repr()
- {
- return var_export($this->getParameters()->toArray(),true);
+ $str = '';
+ if(strlen((string)$this->getCondition()) > 0)
+ $str .= '"'.(string)$this->getCondition().'"';
+ $params = array();
+ foreach($this->getParameters() as $k=>$v)
+ $params[] = "{$k} => ${v}";
+ if(count($params) > 0)
+ $str .= ', "'.implode(', ',$params).'"';
+ $orders = array();
+ foreach($this->getOrdersBy() as $k=>$v)
+ $orders[] = "{$k} => ${v}";
+ if(count($orders) > 0)
+ $str .= ', "'.implode(', ',$orders).'"';
+ if($this->_limit !==null)
+ $str .= ', '.$this->_limit;
+ if($this->_offset !== null)
+ $str .= ', '.$this->_offset;
+ return $str;
}
}