summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/TActiveRecord.php
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data/ActiveRecord/TActiveRecord.php')
-rw-r--r--framework/Data/ActiveRecord/TActiveRecord.php15
1 files changed, 12 insertions, 3 deletions
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().