From 22d29033506b0caa34b4f8f5d16de9f1ffbb6ec9 Mon Sep 17 00:00:00 2001 From: "qiang.xue" <> Date: Tue, 21 Oct 2008 02:13:28 +0000 Subject: Fixed issue #11. --- framework/Data/ActiveRecord/TActiveRecord.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'framework') diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index 6a27acb4..b8eb0b84 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -133,14 +133,14 @@ Prado::using('System.Data.ActiveRecord.Relations.TActiveRecordRelationContext'); * * class UserRecord extends TActiveRecord * { - * public function table() + * public function table() * { * return 'users'; * } * * } * - * + * * @author Wei Zhuo * @version $Id$ * @package System.Data.ActiveRecord @@ -329,6 +329,14 @@ abstract class TActiveRecord extends TComponent $this->_connection=$connection; } + /** + * @return TDbTableInfo the meta information of the table associated with this AR class. + */ + public function getRecordTableInfo() + { + return $this->getRecordGateway()->getRecordTableInfo($this); + } + /** * Compare two records using their primary key values (all column values if * table does not defined primary keys). The default uses simple == for @@ -341,7 +349,7 @@ abstract class TActiveRecord extends TComponent { if($record===null || get_class($this)!==get_class($record)) return false; - $tableInfo = $this->getRecordGateway()->getRecordTableInfo($this); + $tableInfo = $this->getRecordTableInfo(); $pks = $tableInfo->getPrimaryKeys(); $properties = count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys(); $equals=true; -- cgit v1.2.3