I am trying to upgrade my symfony application from version 5.4 to 6.4, as Sensio Bundle is abandoned i need to use attribute instead of annotation , how can i convert paramcoverter annotation to attribute, below is the code
class QuoteDataController extends AbstractController
{
/**
* @Route("/data/quote/list", name="data_quote_list")
* @ParamConverter("query", class="App:ListQuery")
*/
public function dataQuoteList(ListQuery $query, SessionInterface $session): JsonResponse
{
try {
/** @var Contact $user */
$user = $this->getUser();
$session->set('QuoteQuery', $query);
$repo = $this->getDoctrine()
->getRepository(Quote::class);
$payloads = $repo->loadRecords($query, $user);
return new JsonResponse([
'total' => empty($payloads) ? 0 : $payloads[0]->getMeta()['found'],
'rows' => $repo->tableise($payloads),
]);
} catch (Throwable $e) {
// echo $e;
return new JsonResponse([
'total' => 0,
'rows' => [],
]);
}
}
}
I tried the below code , but it is not working as expected
#[Route('/data/quote/list', name: 'data_quote_list')]
#[Entity('query', class: ListQuery::class)]```
New contributor
Hafeel Nasir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.