`pivotFields` functionality broken
See original GitHub issueSo I saw that there is an undocumented feature for adding additional data to pivot columns here:
if (isset($field['pivotFields'])) {
foreach ($field['pivotFields'] as $pivotField) {
foreach ($data[$pivotField] as $pivot_id => $field) {
$model->{$field['name']}()->updateExistingPivot($pivot_id, [$pivotField => $field]);
}
}
}
Looks like the reason for this is that you’re referencing $field['name']
on line 89, even though the $field
variable has been overwritten inside of the current (nested) foreach
.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to Troubleshoot and Fix Excel Pivot Table Errors
How to troubleshoot and fix Excel pivot table errors, such as PivotTable field name is not valid. Find the problem, and fix it....
Read more >vba - Pivot Table: Detect When Pivot Field is Collapsed
I've been looking for a way to detect if ALL of the second position row fields are collapsed/hidden/invisible/not-drilledTo in order to identify ...
Read more >VBA PivotFields.Name returning incorrect result : r/excel - Reddit
It worked until I had to add a new field to the values, and then it broke in the strangest way. Sub test()...
Read more >How to Troubleshoot Pivot Items Missing From Excel Pivot Table
Expand the Pivot Fields · Select one of the pivot items in the outermost pivot field (Region). · On the Excel Ribbon, click...
Read more >Use the Field List to arrange fields in a PivotTable
Rearrange fields in your PivotTable (pivot table) by using the Field List, and show the Field List again when it disappears.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed on dev. Thank you @hewok for the PR! Cheers!
Hi @lloy0076 , no, there is not PR for the bug. [EDIT]: @lloy0076 I’ve created PR.
Hi @tabacitu , I’ve changed the $value of the for loop, exactly the “$pivot_field”. The problem is the variable $field (now, on master branch) on line 99 will be overwritten by for loop on line 106
https://github.com/Laravel-Backpack/CRUD/blob/6e31f985e902bd8d0b5891db143cad8d79427e6e/src/PanelTraits/Create.php#L99-L111
When try to save the page, where I’ve used the addField functionally, I received the error:
because $field[‘name’] (on line 107) is not the correct field name.
If anyone want to try (you need to update some info 😉 ):
I hope I’m making myself clear.