You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto-scaffolding for has_one form fields creates an instance of SearchableDropdownField by passing: SearchableDropdownField::create($this->name, $title, $list, $labelField)
The signature for the SearchableDropdownField constructor expects: string $name, ?string $title = null, ?DataList $source = null, mixed $value = null, string $labelField = 'Title'
So the call is missing $value. This leads to $value being set to $labelField, which is 'Title'.
Not a big deal, since the scaffolding will set the value later again. But it leads to warnings in the php log:
Could not determine value in SilverStripe|Forms|SearchableDropdownField: :getValueArray()
Since this is also affecting my idea for a solution of #11293 I'll create a separate fix and pull request for this issue.
How to reproduce
Given ModelA has_one ModelB and ModelB has_many ModelA:
Open ModelB in Model Admin
Go to the ModelA Tab
Click on Add new Model A
Check Error Log.
Possible Solution
add null as value when calling SearchableDropdownField::create
Additional Context
No response
Validations
Check that there isn't already an issue that reports the same bug
Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)
Module version(s) affected
5.2.13
Description
Auto-scaffolding for has_one form fields creates an instance of SearchableDropdownField by passing:
SearchableDropdownField::create($this->name, $title, $list, $labelField)
The signature for the SearchableDropdownField constructor expects:
string $name, ?string $title = null, ?DataList $source = null, mixed $value = null, string $labelField = 'Title'
So the call is missing $value. This leads to $value being set to $labelField, which is 'Title'.
Not a big deal, since the scaffolding will set the value later again. But it leads to warnings in the php log:
Since this is also affecting my idea for a solution of #11293 I'll create a separate fix and pull request for this issue.
How to reproduce
Given ModelA has_one ModelB and ModelB has_many ModelA:
Check Error Log.
Possible Solution
add
null
as value when calling SearchableDropdownField::createAdditional Context
No response
Validations
silverstripe/installer
(with any code examples you've provided)PRs
The text was updated successfully, but these errors were encountered: