return new JsonResponse( ['filter' =>
['status' =>
$query->filter->status, 'quantity' =>
$query->filter->quantity
]],
);
}}class WithMapRequestPayloadController{ public function __invoke(#[MapRequestPayload] ?RequestBody $body, Request $request): Response
{ if ('json' ===
$request->
getPreferredFormat('json'
)) { if (!
$body) { return new Response('', Response::HTTP_NO_CONTENT
);
} return new JsonResponse(['comment' =>
$body->comment, 'approved' =>
$body->approved
]);
} return new Response( <<<XML
<response>
<comment>{
$body->comment
}</comment>
<approved>