PHP Class mootensai\enhancedgii\BaseGenerator

Inheritance: extends yii\gii\Generator
Datei anzeigen Open project: mootensai/yii2-enhanced-gii Class Usage Examples

Public Properties

Property Type Description
$baseModelClass
$db
$modelClass
$nsModel
$nsSearchModel
$skippedRelations
$tableName
$tableSchema * @var $tableSchema TableSchema
$useSchemaName

Protected Properties

Property Type Description
$classNames
$tableNames

Public Methods

Method 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.

Protected Methods

Method 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

Method 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 method

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

autoCompleteData() public method

public autoCompleteData ( )

checkPivotTable() protected method

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
return 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 method

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
return string the generated class name

generateRelationName() protected method

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
return string the relation name

generateRelations() protected method

protected generateRelations ( ) : array
return array the generated relation declarations

generateTableName() public method

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)
return string the generated table name

getColumnNames() public method

public getColumnNames ( ) : integer[]
return integer[] model column names

getDbConnection() public method

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

getSchemaNames() protected method

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

getTableNames() protected method

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

getTableSchema() public method

public getTableSchema ( )

getTreeColumns() public static method

public static getTreeColumns ( )

isHasManyRelation() protected method

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
return boolean

validateDb() public method

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

validateModelClass() public method

Checks if model class is valid
public validateModelClass ( )

validateTableName() public method

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