[Flow] How to add new child objects from a form
Christian Huppert
chr.huppert at yahoo.de
Fri Jan 17 17:49:28 CET 2014
Hi Axel,
I am beginner but you could give a try to the following:
Before your updateAction you could do the following:
protected function initializeUpdateAction() {
$depositConfiguration = $this->arguments->getArgument('deposit')->getPropertyMappingConfiguration();
$depositConfiguration->allowAllProperties();
$depositConfiguration->setTypeConverterOption(
'TYPO3\Flow\Property\TypeConverter\PersistentObjectConverter',
\TYPO3\Flow\Property\TypeConverter\PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED,
TRUE
);
}
I have it from:
- http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/PropertyMapping.html#configuring-the-conversion-process (section "Property Mapping Configuration in the MVC stack"
and
http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/PropertyMapping.html#security-considerations
Axel Wüstemann <awu at qbus.de> schrieb am 15:51 Freitag, 17.Januar 2014:
Hello,
in my form I have a parent object and n children. I add chield rows with
jQuery.
I get the error
#1335969887: It is not allowed to map property "3". You need to use
$propertyMappingConfiguration->allowProperties('3') to enable mapping of
this property.
one child element in the form goes like this in the html source
<input type="hidden" name="depositInspection[deposits][0][id]"
value="89752" />
<select id="item-0-deposit"
name="depositInspection[deposits][0][deposit]">...</select>
<input id="item-0-amount" type="text"
name="depositInspection[deposits][0][amount]" value="900" />
depositInspection is the parent and deposits are the children.
debugging the propertyMapper loop (Line 162) I get
deposits
array(4)
integer 0 => array(3)
'id' (2) => '89752' (5)
'deposit' (7) => 'Flunder 1' (9)
'amount' (6) => '900' (3)
integer 1 => array(3)
'id' (2) => '89742' (5)
'deposit' (7) => 'Dorsch uns.' (11)
'amount' (6) => '300' (3)
integer 2 => array(3)
'id' (2) => '89762' (5)
'deposit' (7) => 'Scholle 1' (9)
'amount' (6) => '249' (3)
integer 3 => array(3)
'id' (2) => '' (0)
'deposit' (7) => '' (0)
'amount' (6) => '200' (3)
0
array(3)
'id' (2) => '89752' (5)
'deposit' (7) => 'Flunder 1' (9)
'amount' (6) => '900' (3)
id
'89752' (5)
deposit
'Flunder 1' (9)
...
...
3
array(3)
'id' (2) => '' (0)
'deposit' (7) => '' (0)
'amount' (6) => '200' (3)
==> here comes the error, on the newly created element because it is not
yet added to the deposits property of the parent
How I need to construct such a scenario?
Thanks
Axel
_______________________________________________
Flow mailing list
Flow at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/flow
More information about the Flow
mailing list