[TYPO3-mvc] Property mapping a demand object
Bernhard Kraft
kraftb at think-open.at
Mon Mar 21 10:43:07 CET 2016
Hi !
I have a demand object in "Classes/Domain/Dto/DemandProduct.php". I want to pass parameters to a controller and let them get property mapped into this demand object. But for some reason I get the following exception: "#1297759968: Exception while property mapping at property path "":It is not allowed to map property "country". You need to use $propertyMappingConfiguration->allowProperties('country') to enable mapping of this property."
Now when I do as suggested and add the "country" property to the allowed properties I get the following exceptin: "#1297759968: Exception while property mapping at property path "country":It is not allowed to map property "6". You need to use $propertyMappingConfiguration->allowProperties('6') to enable mapping of this property." So I tried fiddling around with something like:
$subConfig = $propertyMappingConfiguration->forProperty('country.*');
$subConfig->allowAllProperties();
But this still doesn't work out.
After digging into the PropertyMapper code for some hours I got bored and thought: Let's try the forum.
So any suggestions?
The argument originats from an POST AJAX request (via jQuery) - I switched to GET so I can test it more easily - this is the URL which fails:
http://testserver.local/index.php?id=431&tx_pimtr_productlist[demand][country][6]=6&tx_pimtr_productlist[listingOnly]=true
The DTO demand object has a property "country" defined as following:
/**
* The country in which the product must be located
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Pim\PimTr\Domain\Model\Country>
* @lazy
*/
protected $country = NULL;
After fiddling around a little bit more I can even produce another exception:
#1297759968: Exception while property mapping at property path "":Creation of objects not allowed. To enable this, you need to set the PropertyMappingConfiguration Value "CONFIGURATION_CREATION_ALLOWED" to TRUE
So I can produce quite a bunch of exceptions but not get the result I wanted :(
ideas anybody?
greetings,
Bernhard
More information about the TYPO3-project-typo3v4mvc
mailing list