[TYPO3-mvc] Error with array argument in Ajax action.
Dirk Wenzel
wenzel at webfox03.de
Thu Dec 19 13:41:30 CET 2013
It seems I found the solution:
/**
* Initialize ajax list action
*/
public function initializeAjaxListAction() {
if($this->arguments->hasArgument('overwriteDemand')) {
$this->arguments->getArgument('overwriteDemand')
->getPropertyMappingConfiguration()
->setTypeConverter(
$this->objectManager->get(
'TYPO3\\CMS\\Extbase\\Property\\TypeConverter\\ArrayConverter')
);
}
}
Cheers
Dirk
Am 19.12.13 10:17, schrieb Dirk Wenzel:
> Hi,
> I got a Controller with an ajax action.
> When calling the action with an (json) array as argument it fails with
> this message:
>
> #1297759968: Exception while property mapping at property path "":No
> converter found which can be used to convert from "array" to "array".
>
> The wiki page which is linked in the error page does not tell anything
> about this kind of error.
>
> I guess I should tell the PropertyMapper to use the TypeConverter
> ArrayConverter. But I can't figur out howl
>
> Here is my code:
> JavaScript:
> var overwriteDemand =
> {"positionTypes":"","sectors":"2","categories":"","categoryConjunction":"or","clientsPositionsOnly":"1"};
>
>
> $.ajax({
> async: 'true',
> url: 'index.php',
> type: 'POST',
> data: {
> eID: "placementsAjax",
> request: {
> pluginName: 'Placements',
> controller: 'Position',
> action: 'ajaxList',
> arguments: {
> 'overwriteDemand': overwriteDemand,
> }
> }
> },[...]
> As you can see, the request is routed by an Ajax Dispatcher.
>
> Controller:
> /**
> * action ajaxList
> *
> * @param \array $overwriteDemand
> * @return void
> */
> public function ajaxListAction($overwriteDemand = NULL) {[...]}
>
> Thanks in advance
> Dirk
More information about the TYPO3-project-typo3v4mvc
mailing list