PHP Class mootensai\enhancedgii\BaseGenerator

Inheritance: extends yii\gii\Generator
Afficher le fichier Open project: mootensai/yii2-enhanced-gii Class Usage Examples

Méthodes publiques

Свойство Type Description
$baseModelClass
$db
$modelClass
$nsModel
$nsSearchModel
$skippedRelations
$tableName
$tableSchema * @var $tableSchema TableSchema
$useSchemaName

Protected Properties

Свойство Type Description
$classNames
$tableNames

Méthodes publiques

Méthode Description
autoCompleteData ( )
generateTableName ( string $tableName ) : string Generates the table name by considering table prefix.
getColumnNames ( ) : integer[]
getDbConnection ( ) : Connection
getTableSchema ( )
getTreeColumns ( )
validateDb ( ) Validates the [[db]] attribute.
validateModelClass ( ) Checks if model class is valid
validateTableName ( ) Validates the [[tableName]] attribute.

Méthodes protégées

Méthode Description
addInverseRelations ( array $relations ) : array Adds inverse relations
checkPivotTable ( yii\db\TableSchema $table ) : array | boolean Checks if the given table is a junction table.
generateClassName ( string $tableName, boolean $useSchemaName = null ) : string Generates a class name from the specified table 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
getSchemaNames ( ) : string[]
getTableNames ( ) : array
isHasManyRelation ( yii\db\TableSchema $table, array $fks ) : boolean Determines if relation is of has many type

Private Methods

Méthode Description
generateManyManyRelations ( yii\db\TableSchema $table, array $fks, array $relations ) : array Generates relations using a junction table by adding an extra viaTable().

Method Details

addInverseRelations() protected méthode

Adds inverse relations
Since: 2.0.5
protected addInverseRelations ( array $relations ) : array
$relations array relation declarations
Résultat array relation declarations extended with inverse relation names

autoCompleteData() public méthode

public autoCompleteData ( )

checkPivotTable() protected méthode

For simplicity, this method only deals with the case where the pivot contains two PK columns, each referencing a column in a different table.
protected checkPivotTable ( yii\db\TableSchema $table ) : array | boolean
$table yii\db\TableSchema
Résultat array | boolean the relevant foreign key constraint information if the table is a junction table, or false if the table is not a junction table.

generateClassName() protected méthode

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
Résultat string the generated class name

generateRelationName() protected méthode

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
Résultat string the relation name

generateRelations() protected méthode

protected generateRelations ( ) : array
Résultat array the generated relation declarations

generateTableName() public méthode

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)
Résultat string the generated table name

getColumnNames() public méthode

public getColumnNames ( ) : integer[]
Résultat integer[] model column names

getDbConnection() public méthode

public getDbConnection ( ) : Connection
Résultat yii\db\Connection the DB connection as specified by [[db]].

getSchemaNames() protected méthode

Since: 2.0.5
protected getSchemaNames ( ) : string[]
Résultat string[] all db schema names or an array with a single empty string

getTableNames() protected méthode

protected getTableNames ( ) : array
Résultat array the table names that match the pattern specified by [[tableName]].

getTableSchema() public méthode

public getTableSchema ( )

getTreeColumns() public static méthode

public static getTreeColumns ( )

isHasManyRelation() protected méthode

Determines if relation is of has many type
Since: 2.0.5
protected isHasManyRelation ( yii\db\TableSchema $table, array $fks ) : boolean
$table yii\db\TableSchema
$fks array
Résultat boolean

validateDb() public méthode

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

validateModelClass() public méthode

Checks if model class is valid
public validateModelClass ( )

validateTableName() public méthode

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

Property Details

$baseModelClass public_oe property

public $baseModelClass

$classNames protected_oe property

protected $classNames

$db public_oe property

public $db

$modelClass public_oe property

public $modelClass

$nsModel public_oe property

public $nsModel

$nsSearchModel public_oe property

public $nsSearchModel

$skippedRelations public_oe property

public $skippedRelations

$tableName public_oe property

public $tableName

$tableNames protected_oe property

protected $tableNames

$tableSchema public_oe property

* @var $tableSchema TableSchema
public $tableSchema

$useSchemaName public_oe property

public $useSchemaName