[TYPO3-mvc] Edit of @lazy property

Marc Bastian Heinrichs typo3 at mbh-web.de
Tue Nov 30 16:26:08 CET 2010


Hey,

>>> I have an edit method which allows me to change the billing contact of a
>>> company. This contact is a @lazy loaded Person object.
>>>
>>> My edit form is as follows:
>>>
>>> <f:form.select id="billingContact" property="billingContact"
>>> value="{company.billingContact}" options="{company.persons}"
>>> optionLabelField="name" />
>>>
>>> When I show the form, I have first person in the list selected (wrong!)
>>>
>>> When I remove the @lazy attribute on billingContact in Company model, I
>>> get the valid person selected.
>>>
>>> Is this a known issue? Already fixed? Using slightly patched version of
>>> Extbase in 4.4 (to have fix of caching issue).
>>
>> AFAIK you don't have to provide a "value" attribute if you bound the
>> field to a property. Please give it a try after removing the value
>> attribute. If this still doesn't work, the following should solve the
>> problem. Instead of value="{company.billingContact}" use
>> value="{company.billingContact.uid}"
> 
> You're right! Removing the "value" attribute then works when @lazy is used.
> 
> Funny, I had the problem with undefined __toString() method which just 
> got committed.

Interesting point. With value="{company.billingContact}" the selected
value key will become "classname:uid", when company.billingContact is
an lazy object, which will be the case, when it's not used before.

So it would be better to return the uid only in default __toString()
method. Otherwise we have to adapt much more code, I think.

Regards,
Marc Bastian


More information about the TYPO3-project-typo3v4mvc mailing list