Bug #81897
openExtbase: delete last IRRE-children does not work
0%
Description
This Bug exists at least since TYPO3 6.2.
If you want to delete the children of an element, it works, but not with the last one.
To reproduce follow these steps:- intall the attached extension in TYPO3 8.7
- create a page with a TS-Template and add the extension's template
- add this to your setup to get an output: page.20 < styles.content.get
- set the storage pid of the extension (e.g. with the constant editor)
- go to the BE-Module list and create a record of type father and add some children (at least 2)
- add the plugin of the extension to see the output in the frontend
- edit your father-record in the frontend. You should see the father-title and the children-titles.
- delete all children except one child and save -> it works.
- edit again, delete the last child and save -> it does not work, the child does not get deleted.
Files
Updated by Gernot Ploiner about 7 years ago
- Subject changed from Extabse: delete last IRRE-children does not work to Extbase: delete last IRRE-children does not work
Updated by Benni Mack about 3 years ago
Hey Gernot,
thanks for your detailed report. I had a look at your extension, made it compatible with TYPO3 v11 and found out that this is because the Fluid Form submits the father record without any information about any children - thus, Extbase fetches the relations again completely.
So your example also works if you have 5 children, and you delete all at once, you save them and nothing changes - because the form does not submit an empty "father[children]" field anymore, so the incoming request cannot handle this (how should it know it should be emptied?). As long as there is one "child" record, the property $father->children is updated from the incoming request.
So the problem lies in the case, that the <form> should actually send something like "empty children storage" flag field (or "NULL") with it, so Extbase would know not to reconstitute the field anymore.
Just to clear the issue up:
Imagine you have another property "spouse" for the father model. just a text field. If you don't have an input field for "spouse" in the update form, and you just hit "save", the spouse field would never be touched.
So I'm not sure if we need to modify fluid, I believe the code comes from the ExtensionBuilder, which would need to handle such a thing with a specific flag in the Fluid template, as the Fluid template currently does not submit such information, so Extbase could handle it.
Updated by Gernot Ploiner about 3 years ago
Hi Benni,
Ok, I understand. But I'm sure, that it is a problem of Extbase, not of the ExtensioBuilder.
Because the ExtensonBuilder does not generate code for childrens.
The main problem is, that I want to use the propertymapper in its full functionality (map also childrens). And with this, it's is not possible to remove all childrens.
A solution can be a new property/setting for the propertymapper. As you said, an "empty children storage flag".
But this should be in the core/extbase, not made by every developer for his own.
Updated by Benni Mack about 3 years ago
Thanks for the nice phone call.
The responsible part would be the MvcPropertyMappingConfiguration and the PersistentObjectConverter.
Ideally the PersistentObjectConverter receives an information for a subproperty "children" to "don't fetch from databsae if not given by incoming data" from the PropertyMappingConfiguration.
ALternatives:- Create a custom TypeConverter
- Create a custom Domain Model for updating