From 7a9626af3bef5c712901597065745d9572c3f097 Mon Sep 17 00:00:00 2001 From: wei <> Date: Tue, 27 Feb 2007 23:48:49 +0000 Subject: BC: Deprecate TActiveRecord::getRecordFinder() in favour of TActiveRecord::finder(). --- framework/Data/ActiveRecord/TActiveRecord.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'framework/Data/ActiveRecord/TActiveRecord.php') diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index 7ab45a2b..8c789ec2 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -41,9 +41,9 @@ Prado::using('System.Data.ActiveRecord.TActiveRecordCriteria'); * public static final $_tablename='users'; //optional table name. * * //returns active record finder instance - * public static function finder() + * public static function finder($className=__CLASS__) * { - * return self::getRecordFinder('UserRecord'); + * return parent::finder($className); * } * } * @@ -143,9 +143,13 @@ abstract class TActiveRecord extends TComponent * Returns the instance of a active record finder for a particular class. * @param string active record class name. * @return TActiveRecord active record finder instance. + * @throws TActiveRecordException if class name equals 'TActiveRecord'. */ - public static function getRecordFinder($class) + public static function finder($className=__CLASS__) { + if($class==='TActiveRecord') + throw new TActiveRecordException('ar_invalid_finder_class_name'); + static $finders = array(); if(!isset($finders[$class])) { @@ -156,6 +160,11 @@ abstract class TActiveRecord extends TComponent return $finders[$class]; } + public static function getRecordFinder($className) + { + throw new TActiveRecordException('Deprecated method, use TActiveRecord::finder()'); + } + /** * Gets the record manager for this object, the default is to call * TActiveRecordManager::getInstance(). -- cgit v1.2.3