trait FormModelWidget

Form Model Widget Trait

Special logic for for form widgets that use a database stored model.

Properties

protected $modelsToSave

Methods

createFormModel()

No description

findFormModel($recordId)

No description

array
resolveModelAttribute(string $attribute = null)

Returns the final model and attribute name of a nested HTML array attribute.

getRelationModel()

Returns the model of a relation type.

getRelationObject()

No description

getRelationType()

No description

prepareModelsToSave($model, $saveData)

No description

void
setModelAttributes(Model $model, array $saveData)

Sets a data collection to a model attributes, relations will also be set.

Details

at line 18
createFormModel()

No description

at line 34
Model findFormModel($recordId)

No description

Parameters

$recordId

Return Value

Model

Exceptions

ApplicationException

at line 62
array resolveModelAttribute(string $attribute = null)

Returns the final model and attribute name of a nested HTML array attribute.

Eg: list($model, $attribute) = $this->resolveModelAttribute($this->valueFrom);

Parameters

string $attribute .

Return Value

array

at line 80
protected Relation getRelationModel()

Returns the model of a relation type.

Return Value

Relation

Exceptions

Exception

at line 94
protected getRelationObject()

No description

at line 108
protected getRelationType()

No description

at line 115
protected prepareModelsToSave($model, $saveData)

No description

Parameters

$model
$saveData

at line 132
protected void setModelAttributes(Model $model, array $saveData)

Sets a data collection to a model attributes, relations will also be set.

Parameters

Model $model

Model to save to

array $saveData

Data to save.

Return Value

void