protected function getRecordTableName(TActiveRecord $record)
{
$class = new ReflectionClass($record);
if ($class->hasConstant(self::TABLE_CONST)) {
$value = $class->getConstant(self::TABLE_CONST);
if (empty($value)) {
throw new TActiveRecordException('ar_invalid_tablename_property', get_class($record), self::TABLE_CONST);
}
return $value;
} elseif ($class->hasMethod(self::TABLE_METHOD)) {
$value = $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));
}
}