Class schmunk42\giiant\generators\model\Generator
Inheritance | schmunk42\giiant\generators\model\Generator » yii\gii\generators\model\Generator |
---|---|
Available since version | 0.0.1 |
This generator will generate one or multiple ActiveRecord classes for the specified database table.
Public Properties
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$classNames2 | schmunk42\giiant\generators\model\Generator |
Public Methods
Method | Description | Defined By |
---|---|---|
attributeLabels() | schmunk42\giiant\generators\model\Generator | |
generate() | schmunk42\giiant\generators\model\Generator | |
generateClassName() | Generates a class name from the specified table name. | schmunk42\giiant\generators\model\Generator |
generateRelationName() | schmunk42\giiant\generators\model\Generator | |
generateRules() | Generates validation rules for the specified table and add enum value validation. | schmunk42\giiant\generators\model\Generator |
getDescription() | schmunk42\giiant\generators\model\Generator | |
getEnum() | Prepare ENUM field values | schmunk42\giiant\generators\model\Generator |
getName() | schmunk42\giiant\generators\model\Generator | |
getTableNames() | schmunk42\giiant\generators\model\Generator | |
hints() | schmunk42\giiant\generators\model\Generator | |
isEnum() | Validate is ENUM | schmunk42\giiant\generators\model\Generator |
requiredTemplates() | schmunk42\giiant\generators\model\Generator | |
rules() | schmunk42\giiant\generators\model\Generator |
Protected Methods
Method | Description | Defined By |
---|---|---|
extractTranslations() | schmunk42\giiant\generators\model\Generator | |
generateRelations() | schmunk42\giiant\generators\model\Generator |
Property Details
Suffix to append to the base model, setting "Base" will result in a model named "PostBase"
Base-traits
Whether to overwrite (extended) model classes, will be always created, if file does not exist
The column name where the language code is stored.
The name of the table containing the translations. {{table}} will be replaced with the value in "Table Name" field.
Key-value pairs for mapping a table-name to class-name, eg. 'prefix_FOObar' => 'FooBar'
String for the table prefix, which is ignored in generated class name
Whether to use or not 2amigos/yii2-translateable-behavior
Method Details
public void attributeLabels ( ) |
protected array extractTranslations ( $tableName, $relations ) | ||
$tableName | ||
$relations | All database's relations. |
|
return | array | Associative array containing the extracted relations and the modified translations. |
---|
public void generate ( ) |
Generates a class name from the specified table name.
public string generateClassName ( $tableName, $useSchemaName = null ) | ||
$tableName | string | The table name (which may contain schema prefix) |
$useSchemaName | ||
return | string | The generated class name |
---|
public void generateRelationName ( $relations, $table, $key, $multiple ) | ||
$relations | ||
$table | ||
$key | ||
$multiple |
protected void generateRelations ( ) |
Generates validation rules for the specified table and add enum value validation.
public array generateRules ( $table ) | ||
$table | \yii\db\TableSchema | The table schema |
return | array | The generated validation rules |
---|
public void getDescription ( ) |
Prepare ENUM field values
public array getEnum ( $columns ) | ||
$columns | array |
public void getName ( ) |
public void getTableNames ( ) |
public void hints ( ) |
Validate is ENUM
public \schmunk42\giiant\generators\model\type isEnum ( $column ) | ||
$column | Table column |
public void requiredTemplates ( ) |
public void rules ( ) |