summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/TActiveRecordGateway.php
diff options
context:
space:
mode:
authormikl <>2008-10-16 08:46:57 +0000
committermikl <>2008-10-16 08:46:57 +0000
commit104100cccd4e7b30ec84ed055fb78745dd94b5b0 (patch)
tree3d4cef9ed43053dd7d0a861ec32119523ee10e75 /framework/Data/ActiveRecord/TActiveRecordGateway.php
parent710a1d43a1ff0f5449529a13d9a93676fbfb3f5d (diff)
Ticket #891 (new static method table() in TActiveRecord)
Diffstat (limited to 'framework/Data/ActiveRecord/TActiveRecordGateway.php')
-rw-r--r--framework/Data/ActiveRecord/TActiveRecordGateway.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecordGateway.php b/framework/Data/ActiveRecord/TActiveRecordGateway.php
index 23104c00..112ec3e8 100644
--- a/framework/Data/ActiveRecord/TActiveRecordGateway.php
+++ b/framework/Data/ActiveRecord/TActiveRecordGateway.php
@@ -31,6 +31,10 @@ class TActiveRecordGateway extends TComponent
* Constant name for specifying optional table name in TActiveRecord.
*/
const TABLE_CONST='TABLE';
+ /**
+ * Method name for returning optional table name in in TActiveRecord
+ */
+ const TABLE_METHOD='table';
/**
* Record gateway constructor.
@@ -65,6 +69,14 @@ class TActiveRecordGateway extends TComponent
throw new TActiveRecordException('ar_invalid_tablename_property',
get_class($record),self::TABLE_CONST);
return $value;
+ }
+ elseif ($class->hasMethod(self::TABLE_METHOD))
+ {
+ $value = call_user_func(array(get_class($record),self::TABLE_METHOD));
+ if(empty($value))
+ throw new TActiveRecordException('ar_invalid_tablename_method',
+ get_class($record),self::TABLE_METHOD);
+ return $value;
}
else
return strtolower(get_class($record));