0 follower

Final Class Yiisoft\Yii\Gii\Generator\ActiveRecord\Command

InheritanceYiisoft\Yii\Gii\Generator\ActiveRecord\Command » Yiisoft\Yii\Gii\Generator\AbstractGeneratorCommand
ImplementsYiisoft\Yii\Gii\GeneratorCommandInterface

Protected Properties

Hide inherited properties

Property Type Description Defined By
$template string Yiisoft\Yii\Gii\Generator\ActiveRecord\Command

Property Details

Hide inherited properties

$template protected property
protected string $template 'default'

Method Details

Hide inherited methods

__construct() public method

public __construct( string $namespace 'App\\Model', string $tableName 'user', string $baseClass ActiveRecord::class, string $template 'default' ): mixed
$namespace string
$tableName string
$baseClass string
$template string

                public function __construct(
    #[Required]
    #[Regex(
        pattern: '/^(?:[a-z][a-z0-9]*)(?:\\\\[a-z][a-z0-9]*)*$/i',
        message: 'Invalid namespace'
    )]
    private readonly string $namespace = 'App\\Model',
    #[Required]
    #[Regex(
        pattern: '/^[\w\-.]+$/i',
        message: 'Invalid table name'
    )]
    #[TableExistsRule]
    private readonly string $tableName = 'user',
    #[Regex(
        pattern: '/^[a-z\\\\]*$/i',
        message: 'Only word characters and backslashes are allowed.',
        skipOnEmpty: true,
    )]
    #[ClassExistsRule]
    private readonly string $baseClass = ActiveRecord::class,
    #[Required(message: 'A code template must be selected.')]
    #[TemplateRule]
    protected string $template = 'default',
) {
    parent::__construct($template);
}

            
getAttributeLabels() public static method

public static getAttributeLabels( ): array

                public static function getAttributeLabels(): array
{
    return [
        'namespace' => 'Model namespace',
        'baseClass' => 'Base class',
        'tableName' => 'Table name',
        'template' => 'Template',
    ];
}

            
getAttributes() public static method

public static getAttributes( ): array

                public static function getAttributes(): array
{
    return [
        'namespace',
        'tableName',
        'baseClass',
        'template',
    ];
}

            
getBaseClass() public method

public getBaseClass( ): string

                public function getBaseClass(): string
{
    return $this->baseClass;
}

            
getHints() public static method

public static getHints( ): array

                public static function getHints(): array
{
    return [
        'namespace' => 'Namespace for the model class to store it in the related directory.',
        'baseClass' => 'Parent class for the new model class.',
        'tableName' => 'Corresponded table name for the model class.',
    ];
}

            
getModelName() public method

public getModelName( ): string

                public function getModelName(): string
{
    return (new Inflector())->tableToClass($this->tableName);
}

            
getNamespace() public method

public getNamespace( ): string

                public function getNamespace(): string
{
    return $this->namespace;
}

            
getTableName() public method

public getTableName( ): string

                public function getTableName(): string
{
    return $this->tableName;
}

            
getTemplate() public method
public getTemplate( ): string

                public function getTemplate(): string
{
    return $this->template;
}