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 19
createFormModel()

No description

at line 35
Model findFormModel($recordId)

No description

Parameters

$recordId

Return Value

Model

Exceptions

ApplicationException

at line 63
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 81
protected Relation getRelationModel()

Returns the model of a relation type.

Return Value

Relation

Exceptions

Exception

at line 95
protected getRelationObject()

No description

at line 109
protected getRelationType()

No description

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

No description

Parameters

$model
$saveData

at line 133
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