[TYPO3-mvc] All childs empty - isModified false. Workaround Question

christian oettinger christian.oettinger at gmx.de
Sat Nov 27 23:24:48 CET 2010


Hi List,

We have a big object with 1:n related childs. We divide the 
creation/editing of the object in forms containing fields of the 
parent(s) and childs.

Example of one Form:
Patient (parent) Fields: Name, Age, Sex
Medcation1 (child): Name, Dose
Medication2 (child): Name, Dose
Maedication3 (child): Name, Dose

When sending the Form we manipulate the request - if all fields of a 
child are empty we delete the child form the request, so it will not be 
validated nore persisted.

This works fine by itself as long as at least one child remains in the 
corresponding field in the request (so in the End in the object 
storage). For example if I had 3 Medications filled in (as above) and I 
delete Medication 3, it is disconnected as we expect. Medication 1 and 2 
remain in the request and are persisted again.
If we remove all three childs though, the childs are not disconnected.
It seems that in the child Object Storage "isModified" is not set.

Now we need some advice please, for we are quite new to extbase:
We made a new class that extendeds Tx_Extbase_Persistence_ObjectStorage. 
In this class we added one function that just sets isModified to true.
In PatientController, when the object storage of the childs counts 0 we 
make a new, empty Object Storage from our new class, call the function 
to set isModified to true and the set it to our object.
It works, but is this a bad Hack or OK?



Thanks in advance!

christian (oe)


More information about the TYPO3-project-typo3v4mvc mailing list