Closed ZsarkZ closed 2 years ago
Are you sure this problem is related to this package ? Could you provide the error you're encountering ? Thanks.
Are you sure this problem is related to this package ? Could you provide the error you're encountering ? Thanks.
exception: "Exception" file: "/home/sark/www/test/vendor/whitecube/nova-flexible-content/src/Flexible.php" line: 394 message: "Unable to parse incoming Flexible content, data should be an array."
I think the problem with HasOne nova field. if i used HasOne nova show two form for one time main form and hasone model form and i think that Flexible field don't understand what form it need
Indeed, it seems to me the HasOne field does not provide the correct data structure to the flexible field. Can you debug and dump what the field is receiving when used inside a HasOne field ?
Indeed, it seems to me the HasOne field does not provide the correct data structure to the flexible field. Can you debug and dump what the field is receiving when used inside a HasOne field ?
Form data looks like this
name: Zimbabwe
slug: zimbabwe
local_name: Zimbabwe
code: ZW
languages:
currencies:
payments:
descriptionDe[name]: test
descriptionDe[slug]: test
descriptionDe[title]:
descriptionDe[capital]:
descriptionDe[population]:
descriptionDe[area]:
descriptionDe[_nova_flexible_content_fields]: ["content"]
descriptionDe[content]: [{"layout":"flex_content","key":"BLT6mJ6rBHAjUsjX","attributes":{"BLT6mJ6rBHAjUsjX__top_description":" test
Alright, can you open your vendor files and add a dump/log after this line in order to get a glimpse of what the incoming request data looks like (the contents of $value
) ?
Alright, can you open your vendor files and add a dump/log after this line in order to get a glimpse of what the incoming request data looks like (the contents of
$value
) ?
[2022-07-18 12:55:37] laravel.WARNING: Return type of Whitecube\NovaFlexibleContent\Layouts\Layout::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/sark/www/test/vendor/whitecube/nova-flexible-content/src/Layouts/Layout.php on line 504
[2022-07-18 12:55:37] local.INFO: null
[2022-07-18 12:55:37] local.INFO: "[{\"layout\":\"flex_content\",\"key\":\"M0t8gmxEkF1YwKbE\",\"attributes\":{\"M0t8gmxEkF1YwKbE__top_description\":\"
test<\/p>\",\"M0t8gmxEkF1YwKbE__bottom_description\":\"
test<\/p>\"}}]"
[2022-07-18 12:55:37] local.ERROR: Unable to parse incoming Flexible content, data should be an array. {"userId":1,"exception":"[object] (Exception(code: 0): Unable to parse incoming Flexible content, data should be an array. at /home/sark/www/test/vendor/whitecube/nova-flexible-content/src/Flexible.php:395)
Hmmm, besides the weird warning (which version of PHP are you using ?), it seems the field is receiving an unparsed JSON string. Meaning the HasOne field does not forward the parsed value. There is not much we can do about it right now, I'm afraid. Did you open an issue on Nova's repository ?
i use php 8.0 and i didn't open an issue on Nova's repository, thanks for help
Hmmm, besides the weird warning (which version of PHP are you using ?), it seems the field is receiving an unparsed JSON string. Meaning the HasOne field does not forward the parsed value. There is not much we can do about it right now, I'm afraid. Did you open an issue on Nova's repository ?
this is what they told me on nova repository
HasOne field has the correct structure and it is working as expected. It could just be the field isn't compatible with nova-flexible-content package.
In that case, maybe you should parse the field's value yourself using one of the available callbacks.
I am encountering the same issue, has there by chance been any progress/update?
I have two models for example a model and a description model with a one to one relationship when i try to create model and description model at the same time i get this error, here is my code
` //main model public function fields(NovaRequest $request) { return [
`
` // description model public function fields(NovaRequest $request) { return [
`
but if you create a model through the description model, then work well