0 follower

Interface Yiisoft\Yii\Gii\GeneratorInterface

Implemented byYiisoft\Yii\Gii\Generator\AbstractGenerator, Yiisoft\Yii\Gii\Generator\ActiveRecord\Generator, Yiisoft\Yii\Gii\Generator\Controller\Generator

Public Methods

Hide inherited methods

Method Description Defined By
generate() Generates the code based on the current user input and the specified code template files. Yiisoft\Yii\Gii\GeneratorInterface
getCommandClass() Yiisoft\Yii\Gii\GeneratorInterface
getDescription() Returns the detailed description of the generator Yiisoft\Yii\Gii\GeneratorInterface
getId() Returns the id of the generator Yiisoft\Yii\Gii\GeneratorInterface
getName() Returns the name of the generator Yiisoft\Yii\Gii\GeneratorInterface
getRequiredTemplates() Returns a list of code template files that are required. Yiisoft\Yii\Gii\GeneratorInterface
getTemplatePath() Yiisoft\Yii\Gii\GeneratorInterface

Method Details

Hide inherited methods

generate() public abstract method

Generates the code based on the current user input and the specified code template files.

This is the main method that child classes should implement. Please refer to Yiisoft\Yii\Gii\Generator\Controller\Generator::generate() as an example on how to implement this method.

public abstract generate( Yiisoft\Yii\Gii\GeneratorCommandInterface $command ): Yiisoft\Yii\Gii\Component\CodeFile\CodeFile[]
$command Yiisoft\Yii\Gii\GeneratorCommandInterface
return Yiisoft\Yii\Gii\Component\CodeFile\CodeFile[]

A list of code files to be created.

throws Yiisoft\Yii\Gii\Exception\InvalidGeneratorCommandException

                public function generate(GeneratorCommandInterface $command): array;

            
getCommandClass() public abstract static method

public abstract static getCommandClass( ): string

                public static function getCommandClass(): string;

            
getDescription() public abstract static method

Returns the detailed description of the generator

public abstract static getDescription( ): string

                public static function getDescription(): string;

            
getId() public abstract static method

Returns the id of the generator

public abstract static getId( ): string

                public static function getId(): string;

            
getName() public abstract static method

Returns the name of the generator

public abstract static getName( ): string

                public static function getName(): string;

            
getRequiredTemplates() public abstract method

Returns a list of code template files that are required.

Derived classes usually should override this method if they require the existence of certain template files.

public abstract getRequiredTemplates( ): string[]
return string[]

List of code template files that are required. They should be file paths relative to getTemplatePath().

                public function getRequiredTemplates(): array;

            
getTemplatePath() public abstract method

public abstract getTemplatePath( Yiisoft\Yii\Gii\GeneratorCommandInterface $command ): string
$command Yiisoft\Yii\Gii\GeneratorCommandInterface
return string

The root path of the template files that are currently being used.

throws Yiisoft\Yii\Gii\Exception\InvalidConfigException
throws ReflectionException

                public function getTemplatePath(GeneratorCommandInterface $command): string;