summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/TActiveRecordGateway.php
diff options
context:
space:
mode:
authorxue <>2007-03-06 20:40:51 +0000
committerxue <>2007-03-06 20:40:51 +0000
commit8a674fb83fa2dd80bc653745e03b24450a9cf68d (patch)
tree83f72026185075b0ffacf5c1996d3424b0e2f31f /framework/Data/ActiveRecord/TActiveRecordGateway.php
parent2ab695a553abf26e530f5e97c1ea357233d80998 (diff)
changed the way to specify active record table.
Diffstat (limited to 'framework/Data/ActiveRecord/TActiveRecordGateway.php')
-rw-r--r--framework/Data/ActiveRecord/TActiveRecordGateway.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecordGateway.php b/framework/Data/ActiveRecord/TActiveRecordGateway.php
index c925f3c9..f9cc5bbd 100644
--- a/framework/Data/ActiveRecord/TActiveRecordGateway.php
+++ b/framework/Data/ActiveRecord/TActiveRecordGateway.php
@@ -25,9 +25,9 @@ class TActiveRecordGateway extends TComponent
private $_tables=array(); //meta data cache.
/**
- * Property name for optional table name in TActiveRecord.
+ * Constant name for specifying optional table name in TActiveRecord.
*/
- const PROPERTY_TABLE_NAME='_tablename';
+ const TABLE_CONST='TABLE';
/**
* Record gateway constructor.
@@ -47,7 +47,7 @@ class TActiveRecordGateway extends TComponent
}
/**
- * Gets the table name from the $_tablename property of the active record
+ * Gets the table name from the 'TABLE' constant of the active record
* class if defined, otherwise use the class name as table name.
* @param TActiveRecord active record instance
* @return string table name for the given record class.
@@ -55,12 +55,12 @@ class TActiveRecordGateway extends TComponent
public function getTableName(TActiveRecord $record)
{
$class = new ReflectionClass($record);
- if($class->hasProperty(self::PROPERTY_TABLE_NAME))
+ if($class->hasConstant(self::TABLE_CONST))
{
- $value = $class->getProperty(self::PROPERTY_TABLE_NAME)->getValue();
- if($value===null)
+ $value = $class->getConstant(self::TABLE_CONST);
+ if(empty($value))
throw new TActiveRecordException('ar_invalid_tablename_property',
- get_class($record),self::PROPERTY_TABLE_NAME);
+ get_class($record),self::TABLE_CONST);
return $value;
}
else