[TYPO3-mvc] repository->update generates new child records

Franz Koch typo3.RemoveForMessage at elements-net.de
Thu Feb 10 15:29:07 CET 2011


Hey,

...
> this just works fine, but if i want to update the basket in the frontend
> every child record is deleted and newly created in the database. the
> basket record itself is updated correctly.

sounds like your basket items don't have a identity yet.

> here is a snippet from the fluid (basket->csvfiles->headerrows only):
>
> <f:form method="post" controller="Csvbasket" action="update"
> name="csvbasket" object="{csvbasket}">
> <f:for each="{csvbasket.csvfiles}" as="file">
> <h3>{file.tablename}</h3>
> <f:form.hidden property="csvfiles.{file.uid}.tableprefix"
> value="{file.tableprefix}" />
> <f:form.hidden property="csvfiles.{file.uid}.tablename"
> value="{file.tablename}" />
> <f:form.hidden property="csvfiles.{file.uid}.contentUid"
> value="{file.contentUid}" />
> <table class="csv-table">
> <thead>
> <f:for each="{file.headerRows}" as="headerrow">
> <f:form.hidden
> property="csvfiles.{file.uid}.headerRows.{headerrow.uid}.rowindex"
> value="{headerrow.rowindex}" />

how does the resulting HTML look like. You're probably missing the 
__identity fields for the child records. If so, just add them manually 
like this:

<f:form.hidden name="csvbasket[csvfiles][{file.uid}][__identity]" 
value="{file.uid}" />

Same goes for any other childs stored in a objectStorage and displayed 
in the form.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list