[TYPO3-mvc] How to save IRRE Values?

Felix Oertel f at oer.tel
Tue Apr 19 15:06:31 CEST 2011


Am 17.04.11 19:10, schrieb Fabian Fisahn:
> Hi List,
>
> I need to save some values of type Tx_Extbase_Persistence_ObjectStorage
> to my database. In the Backend it works with IRRE.

do you wanna create new ones or edit allready existing?

> <f:for each="{product.stores}" as="store">
> 	<f:form.textfield property="??" value="{store.name} />
> 	<f:form.textfield property="??" value="{store.deliverDate} />
> </f:for>

add items like this:

<f:form.textfield property="product.store.some.name" />
<f:form.textfield property="product.store.random.name" />
<f:form.textfield property="product.store.words.name" />

you have to make sure to use the same index (some, random, words) if you 
wanna assign multiple values to one of the new objects.

<f:form.textfield property="product.store.some.name" />
<f:form.textfield property="product.store.some.owner" />
<f:form.textfield property="product.store.words.name" />
<f:form.textfield property="product.store.words.owner" />
<f:form.textfield property="product.store.random.name" />
<f:form.textfield property="product.store.random.owner" />

cause of the missing __identity extbase will create a new object and 
attach it to the objectStorage product.store

if you wanna update your objects you have to simply add the identity. 
let's say you assign {store} (single or through <f:for>)

<f:form.hidden property="product.store.some.__identity" 
value="{store.uid}" />
<f:form.textfield property="product.store.some.name" value="{store.name}" />
<f:form.textfield property="product.store.some.owner" 
value="{store.owner}" />

again it's important to use the same index for extbase to know which 
properties belong to which object.

regards, foertel

ps: of course this is extbase mapper on steroids and not used like it is 
intended to be. ;) a better solution would be to fix stuff in fluid's 
form viewHelper but as we know skurfi is busy so this is a possible 
quick hack.


More information about the TYPO3-project-typo3v4mvc mailing list