[FLOW3-general] Initialize create action for an unknown number of properties
Ivan Ruiz Gallego
ivan at loglan.net
Tue Sep 27 09:16:17 CEST 2011
Hi Dawid,
Do you get the counter value in the initialization method directly from
$_POST?
Thanks,
Ivan.
On 26.09.2011 17:11, Dawid Pacholczyk wrote:
> I have a solution...maybe its not so pro but works :)
>
> I gues that you have some javascript to add new Bar`s or you can do such
> a script. When you add new fieldset for another bar you can always
> create a hidden field with counter of bars and get them in a loop in
> initial method
>
> Best regards,
> Dawid Pacholczyk
>
> W dniu 2011-09-26 10:40, Ivan Ruiz Gallego pisze:
>> Hi,
>>
>> I'd like to create an object Foo that has a OnetoMany association to
>> Bar. I have a single form where the user can decide how many bars might
>> be associated with foo.
>>
>> For a known number of associated bars, let's say 4, I can initialize the
>> create action like this:
>>
>> $this->arguments['foo']->getPropertyMappingConfiguration()->allowCreationForSubProperty('bars');
>>
>>
>> $this->arguments['foo']->getPropertyMappingConfiguration()->allowCreationForSubProperty('bars.0');
>>
>>
>> $this->arguments['foo']->getPropertyMappingConfiguration()->allowCreationForSubProperty('bars.1');
>>
>>
>> $this->arguments['foo']->getPropertyMappingConfiguration()->allowCreationForSubProperty('bars.2');
>>
>>
>> $this->arguments['foo']->getPropertyMappingConfiguration()->allowCreationForSubProperty('bars.3');
>>
>>
>>
>> But if the number of bars is unknown? Is there a way to configure the
>> property mapper of foo so that any number of bars may be created? I'm
>> looking for something like:
>>
>> $this->arguments['foo']->getPropertyMappingConfiguration()->allowCreationForSubProperty('bars');
>>
>>
>> $this->arguments['foo']->getPropertyMappingConfiguration()->allowCreationForSubProperty('bars.*');
>>
>>
>>
>> But this is of course not working!
>>
>> Thanks,
>> Ivan.
>
More information about the FLOW3-general
mailing list