-
Notifications
You must be signed in to change notification settings - Fork 98
Neither view template nor form element (add, edit) are handling hasOne relations #219
Copy link
Copy link
Closed
Milestone
Description
It seems that the view template it trying to show them the same way as belongsTo relation, which is ok, but it ignores it when filtering with map function. BelongsTo and hasOne relations are mixed together into $immediateAssociations array, then this array is filtered checking if the foreingKey exists as a field, which is true for belongsTo associations but not for hasOne:
$immediateAssociations = $associations['BelongsTo'] + $associations['HasOne'];
// ...
$associationFields = collection($fields)
->map(function($field) use ($immediateAssociations) {
foreach ($immediateAssociations as $alias => $details) {
if ($field === $details['foreignKey']) {
return [$field => $details];
}
}
})
->filter()
->reduce(function($fields, $value) {
return $fields + $value;
}, []);As for the form template, used on add and edit, there is no clue of hasOne relations. Is it on purpose?
In the meantime I'm working to see if I can fix view template.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels