Interface Yiisoft\Yii\Gii\GeneratorInterface
| Implemented by | Yiisoft\Yii\Gii\Generator\AbstractGenerator, Yiisoft\Yii\Gii\Generator\ActiveRecord\Generator, Yiisoft\Yii\Gii\Generator\Controller\Generator |
|---|
Public 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
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;
Returns the detailed description of the generator
| public abstract static getDescription( ): string |
public static function getDescription(): string;
Returns the id of the generator
| public abstract static getId( ): string |
public static function getId(): string;
Returns the name of the generator
| public abstract static getName( ): string |
public static function getName(): string;
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;
| 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;
Signup or Login in order to comment.