PHP Класс yii\gii\generators\model\Generator

С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends yii\gii\Generator
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$baseClass
$db
$generateLabelsFromComments
$generateQuery
$generateRelations
$generateRelationsFromCurrentSchema
$modelClass
$ns
$queryBaseClass
$queryClass
$queryNs
$tableName
$useSchemaName
$useTablePrefix

Защищенные свойства (Protected)

Свойство Тип Описание
$classNames
$tableNames

Открытые методы

Метод Описание
attributeLabels ( )
autoCompleteData ( )
generate ( )
generateLabels ( yii\db\TableSchema $table ) : array Generates the attribute labels for the specified table.
generateRules ( yii\db\TableSchema $table ) : array Generates validation rules for the specified table.
generateTableName ( string $tableName ) : string Generates the table name by considering table prefix.
getDescription ( )
getName ( )
getTablePrefix ( ) : string Returns the tablePrefix property of the DB connection as specified
hints ( )
requiredTemplates ( )
rules ( )
stickyAttributes ( )
validateDb ( ) Validates the [[db]] attribute.
validateModelClass ( ) Validates the [[modelClass]] attribute.
validateNamespace ( string $attribute ) Validates the namespace.
validateTableName ( ) Validates the [[tableName]] attribute.

Защищенные методы

Метод Описание
addInverseRelations ( array $relations ) : array Adds inverse relations
checkJunctionTable ( $table ) : array | boolean Checks if the given table is a junction table, that is it has at least one pair of unique foreign keys.
generateClassName ( string $tableName, boolean $useSchemaName = null ) : string Generates a class name from the specified table name.
generateQueryClassName ( string $modelClassName ) : string Generates a query class name from the specified model class name.
generateRelationLink ( array $refs ) : string Generates the link parameter to be used in generating the relation declaration.
generateRelationName ( array $relations, yii\db\TableSchema $table, string $key, boolean $multiple ) : string Generate a relation name for the specified table and a base name.
generateRelations ( ) : array
getDbConnection ( ) : Connection
getSchemaNames ( ) : string[]
getTableNames ( ) : array
isColumnAutoIncremental ( yii\db\TableSchema $table, array $columns ) : boolean Checks if any of the specified columns is auto incremental.
isHasManyRelation ( yii\db\TableSchema $table, array $fks ) : boolean Determines if relation is of has many type

Приватные методы

Метод Описание
generateManyManyRelations ( $table, array $fks, array $relations ) : array Generates relations using a junction table by adding an extra viaTable().

Описание методов

addInverseRelations() защищенный метод

Adds inverse relations
С версии: 2.0.5
protected addInverseRelations ( array $relations ) : array
$relations array relation declarations
Результат array relation declarations extended with inverse relation names

attributeLabels() публичный метод

public attributeLabels ( )

autoCompleteData() публичный метод

public autoCompleteData ( )

checkJunctionTable() защищенный метод

Checks if the given table is a junction table, that is it has at least one pair of unique foreign keys.
protected checkJunctionTable ( $table ) : array | boolean
Результат array | boolean all unique foreign key pairs if the table is a junction table, or false if the table is not a junction table.

generate() публичный метод

public generate ( )

generateClassName() защищенный метод

Generates a class name from the specified table name.
protected generateClassName ( string $tableName, boolean $useSchemaName = null ) : string
$tableName string the table name (which may contain schema prefix)
$useSchemaName boolean should schema name be included in the class name, if present
Результат string the generated class name

generateLabels() публичный метод

Generates the attribute labels for the specified table.
public generateLabels ( yii\db\TableSchema $table ) : array
$table yii\db\TableSchema the table schema
Результат array the generated attribute labels (name => label)

generateQueryClassName() защищенный метод

Generates a query class name from the specified model class name.
protected generateQueryClassName ( string $modelClassName ) : string
$modelClassName string model class name
Результат string generated class name

generateRelationName() защищенный метод

Generate a relation name for the specified table and a base name.
protected generateRelationName ( array $relations, yii\db\TableSchema $table, string $key, boolean $multiple ) : string
$relations array the relations being generated currently.
$table yii\db\TableSchema the table schema
$key string a base name that the relation name may be generated from
$multiple boolean whether this is a has-many relation
Результат string the relation name

generateRelations() защищенный метод

protected generateRelations ( ) : array
Результат array the generated relation declarations

generateRules() публичный метод

Generates validation rules for the specified table.
public generateRules ( yii\db\TableSchema $table ) : array
$table yii\db\TableSchema the table schema
Результат array the generated validation rules

generateTableName() публичный метод

If [[useTablePrefix]] is false, the table name will be returned without change.
public generateTableName ( string $tableName ) : string
$tableName string the table name (which may contain schema prefix)
Результат string the generated table name

getDbConnection() защищенный метод

protected getDbConnection ( ) : Connection
Результат yii\db\Connection the DB connection as specified by [[db]].

getDescription() публичный метод

public getDescription ( )

getName() публичный метод

public getName ( )

getSchemaNames() защищенный метод

С версии: 2.0.5
protected getSchemaNames ( ) : string[]
Результат string[] all db schema names or an array with a single empty string

getTableNames() защищенный метод

protected getTableNames ( ) : array
Результат array the table names that match the pattern specified by [[tableName]].

getTablePrefix() публичный метод

Returns the tablePrefix property of the DB connection as specified
См. также: getDbConnection
С версии: 2.0.5
public getTablePrefix ( ) : string
Результат string

hints() публичный метод

public hints ( )

isColumnAutoIncremental() защищенный метод

Checks if any of the specified columns is auto incremental.
protected isColumnAutoIncremental ( yii\db\TableSchema $table, array $columns ) : boolean
$table yii\db\TableSchema the table schema
$columns array columns to check for autoIncrement property
Результат boolean whether any of the specified columns is auto incremental.

isHasManyRelation() защищенный метод

Determines if relation is of has many type
С версии: 2.0.5
protected isHasManyRelation ( yii\db\TableSchema $table, array $fks ) : boolean
$table yii\db\TableSchema
$fks array
Результат boolean

requiredTemplates() публичный метод

public requiredTemplates ( )

rules() публичный метод

public rules ( )

stickyAttributes() публичный метод

public stickyAttributes ( )

validateDb() публичный метод

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

validateModelClass() публичный метод

Validates the [[modelClass]] attribute.
public validateModelClass ( )

validateNamespace() публичный метод

Validates the namespace.
public validateNamespace ( string $attribute )
$attribute string Namespace variable.

validateTableName() публичный метод

Validates the [[tableName]] attribute.
public validateTableName ( )

Описание свойств

$baseClass публичное свойство

public $baseClass

$classNames защищенное свойство

protected $classNames

$db публичное свойство

public $db

$generateLabelsFromComments публичное свойство

public $generateLabelsFromComments

$generateQuery публичное свойство

public $generateQuery

$generateRelations публичное свойство

public $generateRelations

$generateRelationsFromCurrentSchema публичное свойство

public $generateRelationsFromCurrentSchema

$modelClass публичное свойство

public $modelClass

$ns публичное свойство

public $ns

$queryBaseClass публичное свойство

public $queryBaseClass

$queryClass публичное свойство

public $queryClass

$queryNs публичное свойство

public $queryNs

$tableName публичное свойство

public $tableName

$tableNames защищенное свойство

protected $tableNames

$useSchemaName публичное свойство

public $useSchemaName

$useTablePrefix публичное свойство

public $useTablePrefix