[Flow] Exception after validation error

Winfried Mingst admin at regionalberatung.at
Fri May 17 17:05:26 CEST 2013


I'm looking for hours for a solution. Now I setup a very simple package 
with two models (master, detail, relation 1:1). Master (property name) 
and Detail (properties: detail1, detail2...) should be updateable in one 
form.

The problem is that the dto's  Persistence_Object_Identifiers are 
renewed when updateAction is interrupted by a validation error.
How can I prevent that?


var_dump of $masterAndDetaildto in updateAction when  there is no 
validation error -> works:

\TYPO3\FLOW\var_dump($masterAndDetaildto)

WL\Test\Domain\Dto\Masterdetaildtoprototypeobjectproxy
  master => WL\Test\Domain\Model\Masterprototypepersistableproxy
   Persistence_Object_Identifier => 
'424e9262-f7a2-c3bb-ff4a-d417022f97ee' (36)
   name => 'Hans' (4)
  detail => WL\Test\Domain\Model\Detailprototypepersistableproxy
   Persistence_Object_Identifier => 
'35313225-0ec9-c879-010d-5eefbd627738' (36)
   master => WL\Test\Domain\Model\Masterprototypepersistableproxy
   detail1 => 'Mann' (4)
   detail2 => 'A' (1)
   amount => double 0
-------------------------
var_dump of $masterAndDetaildto in updateAction when there is a 
validation error and after correction updateAction is called again -> 
exception because identifiers are renewed:

\TYPO3\FLOW\var_dump($masterAndDetaildto);

WL\Test\Domain\Dto\Masterdetaildtoprototypeobjectproxy
  master => WL\Test\Domain\Model\Masterprototypepersistableproxy
   Persistence_Object_Identifier => 
'b832029a-9a6a-9aad-f0c5-627d9989bafe' (36)
   name => 'Hans' (4)
  detail => WL\Test\Domain\Model\Detailprototypepersistableproxy
   Persistence_Object_Identifier => 
'b4576ca1-2f0c-3477-7751-702622942cc2' (36)
   master => WL\Test\Domain\Model\Masterprototypepersistableproxy
   detail1 => 'Mann' (3)
   detail2 => 'A' (1)
   amount => double 2
---------------------------




Am 16.05.2013 09:29, schrieb Steffen Wickham:
> Hi Walter,
>
> as the identifier seems to be empty, it would be nice to know how you
> create the Objektwohnraumobjekt model within your DTO method
> "getObjektwohnraumobjekt()" and the annotation of the
> Objektwohnraumobjekt model as well. Normally a new identifier will be
> generated while creating the new object.
>
> Best regards,
> Steffen
>
>
>
>
> Am 16.05.13 09:00, schrieb Walter Meng:
>> Hi,
>> can you help me please?
>>
>> As soon as there is a validation error in my form,  I get this error after
>> correcting the error and executing update or createAction:
>>
>>
>> Uncaught exception #1313663277 in line 186 of
>> ..Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Persistence/Repository.ph
>> p: The object of type "WL\Test\Domain\Model\Objektwohnraumobjekt"
>> (identifier: "") which was passed to EntityManager->update() is not a
>> previously persisted object. Check the code which updates this entity and
>> make sure that only objects are updated which were persisted before.
>> Alternatively use add() for persisting new objects." - See also:
>> 20130516083806c24e93.txt
>>
>> I created a Dto (Data Transfer Object) like described in
>> http://wiki.typo3.org/FLOW3_Cookbook to have multiple objects in one Fluid
>> form.
>>
>> Here is my updateAction
>>
>> http://pastebin.com/ByNzmmkd
>>
>> Regards
>>
>> _______________________________________________
>> Flow mailing list
>> Flow at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
>



More information about the Flow mailing list