Prado\Data\ActiveRecord\TActiveRecordGateway::getRecordTableName PHP Méthode

getRecordTableName() protected méthode

Gets the table name from the 'TABLE' constant of the active record class if defined, otherwise use the class name as table name.
protected getRecordTableName ( TActiveRecord $record ) : string
$record TActiveRecord
Résultat string table name for the given record class.
    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));
        }
    }