PHP Class schmunk42\giiant\generators\model\Generator

Since: 0.0.1
Author: Tobias Munk ([email protected])
Inheritance: extends yii\gii\generators\model\Generator
Afficher le fichier Open project: schmunk42/yii2-giiant Class Usage Examples

Méthodes publiques

Свойство Type Description
$baseClassSuffix suffix to append to the base model, setting "Base" will result in a model named "PostBase"
$baseTraits base-traits
$createdAtColumn the name of the column where the user who updated the entry is stored
$createdByColumn the name of the column where the user who created the entry is stored
$generateHintsFromComments This indicates whether the generator should generate attribute hints by using the comments of the corresponding DB columns
$generateModelClass whether to overwrite (extended) model classes, will be always created, if file does not exist
$languageCodeColumn the column name where the language code is stored
$languageTableName the name of the table containing the translations. {{table}} will be replaced with the value in "Table Name" field
$messageCategory
$removeDuplicateRelations
$savedForm form field for selecting and loading saved gii forms
$singularEntities
$tableNameMap key-value pairs for mapping a table-name to class-name, eg. 'prefix_FOObar' => 'FooBar'
$tablePrefix string for the table prefix, which is ignored in generated class name
$updatedAtColumn the name of the column where the user who updated the entry is stored
$updatedByColumn the name of the column where the user who updated the entry is stored
$useBlameableBehavior whether or not to use BlameableBehavior
$useTimestampBehavior whether or not to use TimestampBehavior
$useTranslatableBehavior whether or not to use 2amigos/yii2-translateable-behavior

Protected Properties

Свойство Type Description
$classNames2

Méthodes publiques

Méthode Description
attributeLabels ( )
formAttributes ( ) : array all form fields for saving in saved forms.
generate ( )
generateClassName ( string $tableName, $useSchemaName = null ) : string Generates a class name from the specified table name.
generateHints ( yii\db\TableSchema $table ) : array Generates the attribute hints for the specified table.
generateRelationName ( $relations, $table, $key, $multiple )
generateRules ( yii\db\TableSchema $table ) : array Generates validation rules for the specified table and add enum value validation.
getDescription ( )
getEnum ( array $columns ) : array prepare ENUM field values.
getName ( )
getTableNames ( )
hints ( )
isEnum ( $column ) : type validate is ENUM.
requiredTemplates ( )
rules ( )
validateDb ( ) Validates the [[db]] attribute.

Méthodes protégées

Méthode Description
extractTranslations ( $tableName, $relations ) : array
generateBlameable ( yii\db\TableSchema $table ) : string[]
generateRelations ( )
generateTimestamp ( yii\db\TableSchema $table ) : string[]
getDbConnection ( ) : Connection

Method Details

attributeLabels() public méthode

public attributeLabels ( )

extractTranslations() protected méthode

protected extractTranslations ( $tableName, $relations ) : array
$relations all database's relations
Résultat array associative array containing the extracted relations and the modified translations

formAttributes() public méthode

all form fields for saving in saved forms.
public formAttributes ( ) : array
Résultat array

generate() public méthode

public generate ( )

generateBlameable() protected méthode

protected generateBlameable ( yii\db\TableSchema $table ) : string[]
$table yii\db\TableSchema the table schema
Résultat string[]

generateClassName() public méthode

Generates a class name from the specified table name.
public generateClassName ( string $tableName, $useSchemaName = null ) : string
$tableName string the table name (which may contain schema prefix)
Résultat string the generated class name

generateHints() public méthode

Generates the attribute hints for the specified table.
public generateHints ( yii\db\TableSchema $table ) : array
$table yii\db\TableSchema the table schema
Résultat array the generated attribute hints (name => hint) or an empty array if $this->generateHintsFromComments is false

generateRelationName() public méthode

public generateRelationName ( $relations, $table, $key, $multiple )

generateRelations() protected méthode

protected generateRelations ( )

generateRules() public méthode

Generates validation rules for the specified table and add enum value validation.
public generateRules ( yii\db\TableSchema $table ) : array
$table yii\db\TableSchema the table schema
Résultat array the generated validation rules

generateTimestamp() protected méthode

protected generateTimestamp ( yii\db\TableSchema $table ) : string[]
$table yii\db\TableSchema the table schema
Résultat string[]

getDbConnection() protected méthode

protected getDbConnection ( ) : Connection
Résultat yii\db\Connection the DB connection from the DI container or as application component specified by [[db]]

getDescription() public méthode

public getDescription ( )

getEnum() public méthode

prepare ENUM field values.
public getEnum ( array $columns ) : array
$columns array
Résultat array

getName() public méthode

public getName ( )

getTableNames() public méthode

public getTableNames ( )

hints() public méthode

public hints ( )

isEnum() public méthode

validate is ENUM.
public isEnum ( $column ) : type
$column table column
Résultat type

requiredTemplates() public méthode

public requiredTemplates ( )

rules() public méthode

public rules ( )

validateDb() public méthode

Validates the [[db]] attribute.
public validateDb ( )

Property Details

$baseClassSuffix public_oe property

suffix to append to the base model, setting "Base" will result in a model named "PostBase"
public $baseClassSuffix

$baseTraits public_oe property

base-traits
public $baseTraits

$classNames2 protected_oe property

protected $classNames2

$createdAtColumn public_oe property

the name of the column where the user who updated the entry is stored
public $createdAtColumn

$createdByColumn public_oe property

the name of the column where the user who created the entry is stored
public $createdByColumn

$generateHintsFromComments public_oe property

This indicates whether the generator should generate attribute hints by using the comments of the corresponding DB columns
public $generateHintsFromComments

$generateModelClass public_oe property

whether to overwrite (extended) model classes, will be always created, if file does not exist
public $generateModelClass

$languageCodeColumn public_oe property

the column name where the language code is stored
public $languageCodeColumn

$languageTableName public_oe property

the name of the table containing the translations. {{table}} will be replaced with the value in "Table Name" field
public $languageTableName

$messageCategory public_oe property

public $messageCategory

$removeDuplicateRelations public_oe property

public $removeDuplicateRelations

$savedForm public_oe property

form field for selecting and loading saved gii forms
public $savedForm

$singularEntities public_oe property

public $singularEntities

$tableNameMap public_oe property

key-value pairs for mapping a table-name to class-name, eg. 'prefix_FOObar' => 'FooBar'
public $tableNameMap

$tablePrefix public_oe property

string for the table prefix, which is ignored in generated class name
public $tablePrefix

$updatedAtColumn public_oe property

the name of the column where the user who updated the entry is stored
public $updatedAtColumn

$updatedByColumn public_oe property

the name of the column where the user who updated the entry is stored
public $updatedByColumn

$useBlameableBehavior public_oe property

whether or not to use BlameableBehavior
public $useBlameableBehavior

$useTimestampBehavior public_oe property

whether or not to use TimestampBehavior
public $useTimestampBehavior

$useTranslatableBehavior public_oe property

whether or not to use 2amigos/yii2-translateable-behavior
public $useTranslatableBehavior