[TYPO3-mvc] How to persist forms editing only a childObject
Franz Koch
typo3.RemoveForMessage at elements-net.de
Fri Nov 26 18:53:47 CET 2010
Hey,
> Now I'd like to create a edit for just for the userData and I'm
> wondering how to correctly persist the modified object after editing. I
> was thinking about two possibilities:
>
> a) fetch the child object from the main object and pass it as clone to
> the view. After it's edited and ready for storing (update action) I
> thought I just update it in the repository (which I would have to create
> only for that purpose, I don't need it otherways) and I'm fine.
>
> b) assign the main object (the account) to the view and grab the child
> object directly from there in the view. In the update action then simply
> overwrite the incoming object in the main object.
Ok, what I have did now and what's working:
- use the child object directly from the parent object and define it as
main object for the form
- on the update action simply override it in your parent object again
and you're done
One thing I stubmled over is, that you really have to take care of that
your child object is NOT a instance of a LazyLoadingProxy if you use it
directly from your parent object. If you do so, Fluid will not create a
hidden __identity field and thus you'll lose track of the original object.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list