Class yii\gii\generators\extension\Generator
Inheritance | yii\gii\generators\extension\Generator » yii\gii\Generator » yii\base\Model |
---|---|
Available since version | 2.0 |
This generator will generate the skeleton files needed by an extension.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$authorEmail | yii\gii\generators\extension\Generator | ||
$authorName | yii\gii\generators\extension\Generator | ||
$description | yii\gii\generators\extension\Generator | ||
$enableI18N | boolean | Whether the strings will be generated using Yii::t() or normal strings. |
yii\gii\Generator |
$keywords | yii\gii\generators\extension\Generator | ||
$license | yii\gii\generators\extension\Generator | ||
$messageCategory | string | The message category used by Yii::t() when $enableI18N is true . |
yii\gii\Generator |
$namespace | yii\gii\generators\extension\Generator | ||
$outputPath | yii\gii\generators\extension\Generator | ||
$packageName | yii\gii\generators\extension\Generator | ||
$template | string | The name of the code template that the user has selected. | yii\gii\Generator |
$templates | array | A list of available code templates. | yii\gii\Generator |
$title | yii\gii\generators\extension\Generator | ||
$type | yii\gii\generators\extension\Generator | ||
$vendorName | yii\gii\generators\extension\Generator |
Public Methods
Property Details
Method Details
public void attributeLabels ( ) |
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 yii\gii\generators\controller\Generator::generate() as an example on how to implement this method.
public yii\gii\CodeFile[] generate ( ) | ||
return | yii\gii\CodeFile[] | A list of code files to be created. |
---|
public string getDescription ( ) | ||
return | string | The detailed description of the generator. |
---|
public string getKeywordsArrayJson ( ) | ||
return | string | A json encoded array with the given keywords |
---|
public string getName ( ) | ||
return | string | Name of the code generator |
---|
public boolean getOutputPath ( ) | ||
return | boolean | The directory that contains the module class |
---|
Returns the list of hint messages.
The array keys are the attribute names, and the array values are the corresponding hint messages. Hint messages will be displayed to end users when they are filling the form for the generator.
public array hints ( ) | ||
return | array | The list of hint messages |
---|
public array optsLicense ( ) | ||
return | array | Options for license drop-down |
---|
public array optsType ( ) | ||
return | array | Options for type drop-down |
---|
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 array requiredTemplates ( ) | ||
return | array | List of code template files that are required. They should be file paths relative to \yii\gii\generators\extension\templatePath. |
---|
Child classes should override this method like the following so that the parent rules are included:
return array_merge(parent::rules(), [
...rules for the child class...
]);
public void rules ( ) |
Returns the list of sticky attributes.
A sticky attribute will remember its value and will initialize the attribute with this value when the generator is restarted.
public array stickyAttributes ( ) | ||
return | array | List of sticky attributes |
---|
Returns the message to be displayed when the newly generated code is saved successfully.
Child classes may override this method to customize the message.
public string successMessage ( ) | ||
return | string | The message to be displayed when the newly generated code is saved successfully. |
---|