[Flow] identifier gets lost in form
Winfried Mingst
wm at psoft.at
Sun Jun 30 13:39:34 CEST 2013
Hi Alexander,
I debuged "detail" before and after a validation error in edit form.
I'm on latest 2.0 dev-master.
initial detail:
http://666kb.com/i/cfdxxs0ydkfnkam2v.jpg
after form is reloaded:
http://666kb.com/i/cfdxyx7w8ilx14j0n.jpg
hidden field for master has disapeared
{detail->f:debug()} still holds the right identifier. But afer submission a
new master record is created an associated with detail.
Repository
http://github.com/regioadmin/WL.Test/blob/master/Classes/WL/Test/Controller/
DetailController.php
Cheers
Winfried
-----Ursprüngliche Nachricht-----
Von: flow-bounces at lists.typo3.org [mailto:flow-bounces at lists.typo3.org] Im
Auftrag von Alexander Berl
Gesendet: Samstag, 29. Juni 2013 16:13
An: flow at lists.typo3.org
Betreff: Re: [Flow] identifier gets lost in form
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/Template
s/Detail/Edit.html
>
>
>
> What's wrong? Do I need some additional subPropertyMapping config?
>
> thx
>
> Winfried
_______________________________________________
Flow mailing list
Flow at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
More information about the Flow
mailing list