From 29a0110f5f531ad72125a43b325c46fb2dc99c26 Mon Sep 17 00:00:00 2001 From: Divyajose <75604843+divya-intelli@users.noreply.github.com> Date: Tue, 23 May 2023 15:09:30 +0530 Subject: [PATCH] Fix for setIgnoredAttributes() method is deprecated (#238) --- src/Api/Management/Query/StatsQueryNormalizer.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Api/Management/Query/StatsQueryNormalizer.php b/src/Api/Management/Query/StatsQueryNormalizer.php index 177948f4..3578c942 100644 --- a/src/Api/Management/Query/StatsQueryNormalizer.php +++ b/src/Api/Management/Query/StatsQueryNormalizer.php @@ -19,6 +19,7 @@ namespace Apigee\Edge\Api\Management\Query; use Apigee\Edge\Serializer\JsonEncoder; +use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; use Symfony\Component\Serializer\Serializer; @@ -44,7 +45,6 @@ class StatsQueryNormalizer implements NormalizerInterface public function __construct() { $this->objectNormalizer = new ObjectNormalizer(); - $this->objectNormalizer->setIgnoredAttributes(['timeRange']); $this->serializer = new Serializer([$this->objectNormalizer], [new JsonEncoder()]); } @@ -55,7 +55,7 @@ public function normalize($object, $format = null, array $context = []) { /** @var StatsQueryInterface $object */ // Transform the object to JSON and back to an array to keep boolean values as boolean. - $json = $this->serializer->serialize($object, 'json'); + $json = $this->serializer->serialize($object, 'json', [AbstractNormalizer::IGNORED_ATTRIBUTES => ['timeRange']]); $data = $this->serializer->decode($json, 'json'); // Replace metrics with the required query parameter name and value. $data['select'] = implode(',', $data['metrics']);