How can I remove doctrine proxies field in symfony 5 json?

My code:

public function findAll(): JsonResponse { 
$products = $this->productRepository->findAll();

    return $this->json((
        new ApiJsonResponse(ApiJsonResponse::TYPE_SUCCESS, $products)
    ));
}
return: "productType": { "id": 1, "name": "product type 1", "active": true, "initializer": null, "cloner": null, "isInitialized": true }

I’m using sumfony 5 and I wanted to remove it globally

Thanks!

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *