Category: json

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…

How to validate doctrine type "json" with symfony json constraint in a form correctly?

So, I’d like to enter some json into a form for it to be validated by symfonys json constraint: /** * @AssertJson( * message = “variantJson field: invalid Json.” * ) * @ORMColumn(type=”json”, nullable=true) */ private $variantJson = []; The…