[Flow] Type mapping for ArrayCollection Objects
Rocky
rockysynergy at gmail.com
Tue Jun 17 04:26:24 CEST 2014
Hi,
The aggregate root object has many subObject. In the AggregateRoot.php I have below code:
/**
* @var \Doctrine\Common\Collections\Collection<\My\App\Domain\Model\SubObject>
* @ORM\OneToMany(mappedBy="aggregateRoot",cascade="all")
*/
protected $subObjects;
The SubObject is an entity and has its own properties. In the New.html for AggregateRootController's new action, I have below code:
<label for="subObjects.1.propertyA">Property A</label>
<f:form.textfield property="subObjects.1.propertyA" id="subObjects.1.propertyA" />
<label for="subObjects.1.propertyB">Property B</label>
<f:form.textfield name="subObjects.1.propertyB" id="subObjects.1.propertyB" />
When I submit the form, I got below exception:
Uncaught Exception in Flow
#1297759968: Exception while property mapping for target type "My\App\Domain\Model\AggregateRoot", at property path "": Property "subObjects" having a value of type "Doctrine\Common\Collections\ArrayCollection" could not be set in target object of type "My\App\Domain\Model\AggregateRoot".
I have tried something like below code but no luck:
protected function initializeUpdateAction() {
$commentConfiguration = $this->arguments['comment']->getPropertyMappingConfiguration();
$commentConfiguration
->forProperty('items.*')
->setTypeConverterOption(
'TYPO3\Flow\Property\TypeConverter\PersistentObjectConverter',
\TYPO3\Flow\Property\TypeConverter\PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED,
TRUE
);
}
Any idea how can I make TYPO3 Flow do the type mapping for ArrayCollection objects, so I could create the whole aggregate with one form please?
More information about the Flow
mailing list