PHP Trait schmunk42\giiant\generators\crud\ModelTrait

Show file Open project: schmunk42/yii2-giiant

Public Methods

Method Description
createRelationRoute ( $relation, $action )
generateRelationTo ( $relation )
getColumnByAttribute ( $attribute, $model = null )
getModelByTableName ( $name )
getModelNameAttribute ( $modelClass )
getModelRelations ( ActiveRecord $modelClass, array $types = ['belongs_to', 'many_many', 'has_many', 'has_one', 'pivot'] ) : array Finds relations of a model class.
getRelationByColumn ( $model, $column ) : null | ActiveQuery
isPivotRelation ( ActiveQuery $relation )

Method Details

createRelationRoute() public method

public createRelationRoute ( $relation, $action )

generateRelationTo() public method

public generateRelationTo ( $relation )

getColumnByAttribute() public method

public getColumnByAttribute ( $attribute, $model = null )

getModelByTableName() public method

public getModelByTableName ( $name )

getModelNameAttribute() public method

public getModelNameAttribute ( $modelClass )

getModelRelations() public method

return values can be filtered by types 'belongs_to', 'many_many', 'has_many', 'has_one', 'pivot'
public getModelRelations ( ActiveRecord $modelClass, array $types = ['belongs_to', 'many_many', 'has_many', 'has_one', 'pivot'] ) : array
$modelClass ActiveRecord
$types array
return array

getRelationByColumn() public method

public getRelationByColumn ( $model, $column ) : null | ActiveQuery
$column
return null | yii\db\ActiveQuery

isPivotRelation() public method

public isPivotRelation ( ActiveQuery $relation )
$relation yii\db\ActiveQuery