[Flow] identifier gets lost in form

Alexander Berl a.berl at outlook.com
Sat Jun 29 16:12:55 CEST 2013


Hi Winfried,

some things I notice in your code:

1. newAction does not have the Detail object as optional parameter,
hence when there are validation errors in createAction, all input will
be lost because the invalidated object isn't provided to the template

2. editAction (and newAction after following 1.) should add
@Flow\IgnoreValidation("$detail") annotation, so that validation errors
don't create an infinite redirect

Regarding your problem with the missing master __identity after
validation errors however, I can not see any obvious error.
It *could* be a bug in Flow/Fluid, best would be some debugging on what
happens with the Detail object in editAction when an validation error
occured, so maybe you could do some debug output if the master property
is still correctly set. If it is, then it's maybe a problem with the
form viewhelper.
Would be good if you could then also provide information on what version
you're currently on (master/1.x/2.0).

Regards,
Alexander

Am 28.06.2013 16:12, schrieb Winfried Mingst:
> Hi Flowx,
> 
> I try to edit properties of two models in one form desperately.
> There is a "master" and "detail" model/entity (1:1 unidirectional
> relation, "detail" holds foreign key @ORM OneToOne(
> cascade={"persist","remove"}))
> 
> Source code of edit form shows identifiers of both models initialy:
> 
> <input type="hidden" name="detail[__identity]" value="20390230..." />
> <input type="hidden" name="detail[master][__identity]"
> value="91a3aa0..." />
> 
> 
> BUT if the form is reloaded in case of a validation error, the 2nd
> hidden field gets lost!
> The result is a duplicate dataset in table master when the form is
> resubmitted.
> 
> here is my Controller
> https://github.com/regioadmin/WL.Test/blob/master/Classes/WL/Test/Controller/DetailController.php
> 
> here is my edit form
> https://github.com/regioadmin/WL.Test/blob/master/Resources/Private/Templates/Detail/Edit.html
> 
> 
> 
> What's wrong?  Do I need some additional subPropertyMapping config?
> 
> thx
> 
> Winfried


More information about the Flow mailing list