[Flow] Exception after validation error

Winfried Mingst wm at psoft.at
Sat May 18 00:30:07 CEST 2013


Hello Steffen,

no the objects are not persisted.
I did this:

* @param \WL\Test\Domain\Dto\Masterdetaildto $masterAndDetail
* @return void
*/
public function updateAction(\WL\Test\Domain\Dto\Masterdetaildto
$masterAndDetail) {
	$modelMaster=$masterAndDetail->getMaster();
	$modelDetail=$masterAndDetail->getDetail();
	\TYPO3\FLOW\var_dump($masterAndDetail);
	


-----Ursprüngliche Nachricht-----
Von: flow-bounces at lists.typo3.org [mailto:flow-bounces at lists.typo3.org] Im
Auftrag von Steffen Wickham
Gesendet: Freitag, 17. Mai 2013 20:08
An: flow at lists.typo3.org
Betreff: Re: [Flow] Exception after validation error

Hello Winfried,

I had a look on your code snippets yesterday evening. I can't find any
problems in your implementation of the models and DTO. :-(
Maybe someone of the core team member can help? I can't predict what
happens here. Sorry!

For your test below: Are those master and detail objects already
persisted and received through the matching repository or are they
generated on the fly in your respective method (updateAction)?

Best regards,
Steffen




Am 17.05.2013 17:05, schrieb Winfried Mingst:
> 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
>>
>
> _______________________________________________
> Flow mailing list
> Flow at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow

_______________________________________________
Flow mailing list
Flow at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/flow



More information about the Flow mailing list