[Flow] array of objects and validators
mario chiari
ml at mariochiari.net
Tue Oct 15 16:11:25 CEST 2013
On Tue, 2013-10-15 at 11:29 +0200, Bastian Waidelich wrote:
> mario chiari wrote:
>
> Hi Mario,
>
> > I need some help with validators.
> > Say I have a basic Father/Son model, and a New template to create
> > several Fathers and theirs Sons at once.
>
> "Several fathers" - I wouldn't call that basic but rather modern, but we
> already had that didn't we :)
unfortunately, still very traditional: father-son is a tree :-)
>
>
> > http://pastebin.com/jJk2Aqb3 .
> >
> > My createAction cycles over the array of Fathers and creates Father
> > objects by
> > $fatherObj = $propertyMapper->convert($fthArray, '\...\Model\Father');
>
>
> You shouldn't have to use the PropertyMapper manually. Ever.
Ever?
>
> Don't
> http://pastebin.com/k5khWf1t
>
> work for you? Then validation is applied automagically.
With yours, I get the error 438: The value given to add() was array,
however the Mario\Basic\Domain\Repository\FatherRepository can only
store Mario\Basic\Domain\Model\Father instances.
Anyway, I have some update, see at http://pastebin.com/2Gip3DSJ (see
description of what happens at the very end)
Now, it seems that something goes wrong because there are input fields
for both father and sons objects. Do you spot anything I wrote wrong?
thanks for your help
cheers
mario
what else?
thanks
mario
>
>
More information about the Flow
mailing list