[FLOW3-general] Creating objects with collections
Pankaj Lele
pankaj at lelesys.com
Sat Dec 31 08:35:00 CET 2011
Hello
I was looking for a best approach to create a new object along with its
property having a collection.
E.g. Post has property tags of type
\Doctrine\Common\Collection\ArrayCollection<\My\Package\Domain\Model\Tag>
When creating a post with a Fluid form what to do about posting multiple
tags?
<f:form.textfield property="tags.0.name" />
<f:form.textfield property="tags.1.name" />
This does not work even if the object creation for properties is activated.
For now to get this working we have to do in Fluid:
<f:form.textfield name="tags[0]name" />
<f:form.textfield name="tags[1]name" />
And in the PostController->initializeCreateAction() get the tags raw
argument and convert them to objects using propertyMapper and pass on
array of objects to createAction($post, $tags).
Is this good approach or is there any other way which me might not be
knowing?
Thanks in advance!
--
With best regards,
Pankaj Lele
---------------------------
CTO & Executive Director
Lelesys Infotech Pvt. Ltd.
Pune/Goa, India
Web: http://www.lelesys.com
[Certified TYPO3 Integrator]
More information about the FLOW3-general
mailing list