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 {@see \Yiisoft\Yii\Gii\Generator\Controller\Generator::generate()} as an example on how to implement this method.
| public abstract Yiisoft\Yii\Gii\Component\CodeFile\CodeFile[] generate ( Yiisoft\Yii\Gii\GeneratorCommandInterface $command ) | ||
| $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 string getDescription ( ) |
public static function getDescription(): string;
Returns the id of the generator
| public abstract static string getId ( ) |
public static function getId(): string;
Returns the name of the generator
| public abstract static string getName ( ) |
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 string[] getRequiredTemplates ( ) | ||
| return | string[] |
List of code template files that are required. They should be file paths relative to {@see \Yiisoft\Yii\Gii\getTemplatePath()}. |
|---|---|---|
public function getRequiredTemplates(): array;
| public abstract string getTemplatePath ( Yiisoft\Yii\Gii\GeneratorCommandInterface $command ) | ||
| $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.