[FLOW3-general] help needed: editing multiple objects in one form
Wasko
admin at regionalberatung.at
Wed Mar 20 11:48:03 CET 2013
Am 18.03.2013 11:08, schrieb Wasko:
> Am 15.03.2013 10:00, schrieb Bastian Waidelich:
>> Wasko wrote:
>>
>> Hi Wasko(?),
>>
>>> I'm programing a simple app to learn how to create and edit data from
>>> two objects in one form (dto).[...]
>>
>>> /wl.test/masterdetail/edit?masterdetaildto[__identity]=123456
>>> Exception while property mapping for target type
>>> "WL\Test\Domain\Dto\Masterdetaildto" [...]
>>
>>
>> Your Dto wouldn't contain a @FLOW3\Entity annotation. Thus it is not
>> persisted and it won't have an "__identity".
>> Instead you should add the real entities to your link arguments and
>> build the Dto in your controller.
>>
>> I have added that scenario to the example at:
>>
>> http://wiki.typo3.org/Flow_Cookbook#Create_multiple_objects_with_one_Fluid_form
>>
>>
>>
>> HTH,
>>
> Hi Bastian,
> with your help I'm almost there. THX !!!
>
> There is only one problem in my updateAction I could not solve.
> CustomerUser (in my repo called Detail) is updated but User (Master)
> ends up with an error when executing
>
> $this->masterRepository->update($modelMaster);
>
> ERROR
>
> Catchable Fatal Error: Argument 1 passed to
> Doctrine\Common\Collections\ArrayCollection::__construct() must be of
> the type array, object given, called in
> /var/www/flow-base-distribution/Packages/Libraries/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php
> on line 519 and defined in
> /var/www/flow-base-distribution/Packages/Libraries/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php
> line 48
>
> var_dump of $modelMaster tells me:
>
>
> WL\Test\Domain\Model\Masterprototypepersistableproxy
> Persistence_Object_Identifier =>
> 'a7467f2e-038d-4002-8e4f-b7b009cc0e22' (36)
> name => 'Apple' (5)
> detail => WL\Test\Domain\Model\Detailprototypepersistableproxy
> Persistence_Object_Identifier =>
> '39c180fa-6dec-4382-beac-93bc2cb45001' (36)
> detail1 => 'green' (5)
> detail2 => 'delicous' (8)
> master => WL\Test\Domain\Model\Masterprototypepersistableproxy
>
>
>
> This is my Controlle's source:
> https://github.com/regioadmin/WL.Test/blob/master/Classes/WL/Test/Controller/MasterController.php
>
>
> Regards
>
> Wasko
OK, I found the problem. It was the mapping in the model which was
bidirectional.
More information about the FLOW3-general
mailing list