Closed hussonkevin closed 1 year ago
Hi Kevin,
Thank you for your contribution. We know this case and we actually correct it on Sylius directly using this patch : https://github.com/sylius/sylius/pull/13666
But it does not work since Sylius 1.11 and we haven't go another patch at this moment. We had a discussion about this issue before on #174 and we have specific case when indexes are not integer as said @jacquesbh in https://github.com/monsieurbiz/SyliusRichEditorPlugin/pull/174#issuecomment-1054461706
When you get an element with form type CollectionType and you create 3 items, you'll get the following indices
[0 => data, 1 => data, 2 => data]
If you remove the index 1 then you get the following indices[0 => data, 2 => data]
When you save the page, all elements are saved into json object but the format of this sub element is converted into object instead of array. To fix that you need to applyarray_values()
to reset keys. This function cannot be applied on a Form Event because you override form data with the request into this methodprocessFormDataWithoutChild
due to this: