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
Description
When using the RecordFinder form widget with a model that implements the NestedTree trait, the system incorrectly reports that the 'parent_id' field does not exist in the model, even though the field is properly defined in the database table and included in the model's $fillable array.
Steps to Reproduce
Create a model that uses the NestedTree trait (e.g., ProductCategory)
Add the necessary database fields (parent_id, nest_left, nest_right, nest_depth)
Define parent and children relationships in the model
Configure a form with a RecordFinder field type to select parent_id
Attempt to create or edit a record
Expected Behavior
The RecordFinder should properly recognize the parent_id field and allow selection of a parent record.
Actual Behavior
The system displays an error: "Model '[Namespace][ModelName]' does not contain 'parent_id'."
Workaround
Replacing the RecordFinder with a Dropdown field type and implementing a getParentIdOptions() method in the model resolves the issue.
Suggested Fix
Modify the RecordFinder component to properly recognize and handle the parent_id field when used with the NestedTree trait. This would allow developers to use both features together without conflict.
Additional Context
This issue specifically occurs at the intersection of two Winter CMS features: the RecordFinder form widget and the NestedTree trait. Both work fine independently, but fail when used together to manage hierarchical relationships within the same model.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Description
When using the RecordFinder form widget with a model that implements the NestedTree trait, the system incorrectly reports that the 'parent_id' field does not exist in the model, even though the field is properly defined in the database table and included in the model's $fillable array.
Steps to Reproduce
Expected Behavior
The RecordFinder should properly recognize the parent_id field and allow selection of a parent record.
Actual Behavior
The system displays an error: "Model '[Namespace][ModelName]' does not contain 'parent_id'."
Workaround
Replacing the RecordFinder with a Dropdown field type and implementing a getParentIdOptions() method in the model resolves the issue.
Technical Details
Winter CMS version: [Winter CMS 1.2.0]
PHP version: [PHP 8.2.26]
Database: MySQL [MySQL 8.0.40]
Suggested Fix
Modify the RecordFinder component to properly recognize and handle the parent_id field when used with the NestedTree trait. This would allow developers to use both features together without conflict.
Additional Context
This issue specifically occurs at the intersection of two Winter CMS features: the RecordFinder form widget and the NestedTree trait. Both work fine independently, but fail when used together to manage hierarchical relationships within the same model.
Beta Was this translation helpful? Give feedback.
All reactions