[FLOW3-general] Creating two objects in one form

Winfried Holler mailtestler at web.de
Mon Dec 17 13:36:50 CET 2012


Hi David,

I'm stuck with the same problem  trying to implement such a dto. Where can I 
find a example? Can you post
sources of  a working dto, controller, template...?

Regards

Winfried

"David Sporer" <david.sporer at googlemail.com> schrieb im Newsbeitrag 
news:mailman.879.1343812941.626.flow3-general at lists.typo3.org...
> Hi Bastian,
>
> thank you!
> This was what I meant by talking about a new Model I just missed the term
> DTO yesterday evening :-)
>
> Will give it a try tonight.
>
> Regards
> David
>
> 2012/8/1 Bastian Waidelich <bastian at typo3.org>
>
>> David Sporer wrote:
>>
>> Hi David,
>>
>>  I have two models Customer and CustomerUser and I want to create a
>>> Register.html Fluid Template to create both [...]
>>>
>>
>> The easiest solution is probably to create a so called Data Transfer
>> Object [1].
>> I usually store them in a folder "Dto":
>>
>>
>> <?php
>> namespace Your\Package\Domain\Dto;
>>
>> class CustomerAndUserDto {
>>
>>         /**
>>          * @var \Your\Package\Domain\Model\**Customer
>>          */
>>         protected $customer;
>>
>>
>>         /**
>>          * @var \Your\Package\Domain\Model\**CustomerUser
>>          */
>>         protected $customerUser;
>>
>>         // getters & setters ...
>>
>> }
>> ?>
>>
>>
>> and then in the Fluid form:
>>
>>
>> <f:form action="create" objectName="**newCustomerAndUser">
>>   <f:form.textfield property="customer.**someCustomerProperty" />
>>   <f:form.textfield property="customerUser.**someUserProperty" />
>>   ...
>> </f:form>
>>
>> (untested)
>>
>> The advantage is that you have mapping & validation errors in one place
>> and that you can create a base validator for the Dto.
>>
>>
>> Note: The Dto is not persisted, it must not have an @FLOW3\Entity
>> annotation.
>>
>>
>> HTH
>>
>>
>> [1] 
>> http://en.wikipedia.org/wiki/**Data_Transfer_Object<http://en.wikipedia.org/wiki/Data_Transfer_Object>
>>
>> --
>> Bastian Waidelich
>> TYPO3 Core Team Member
>>
>> TYPO3 .... inspiring people to share!
>> Get involved: typo3.org
>>
>> ______________________________**_________________
>> FLOW3-general mailing list
>> FLOW3-general at lists.typo3.org
>> http://lists.typo3.org/cgi-**bin/mailman/listinfo/flow3-**general<http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general>
>> 




More information about the FLOW3-general mailing list