How to save belongsTo relation in one form without using relation form widget on create
1
public function formExtendModel($model)
{
if ($this->action == 'create') {
$model->address = new \Company\Plugin\Models\Address();
}
return $model;
}
Define your fields in fields.yaml as
fields:
address[streetname]:
label: Name
type: text
address[housenumber]:
label: House Number
type: text
address[zip]:
label: Zip
type: text
There are no comments yet
Be the first one to comment