diff --git a/src/Api/Management/Denormalizer/AppDenormalizer.php b/src/Api/Management/Denormalizer/AppDenormalizer.php index b096c058..1296433b 100644 --- a/src/Api/Management/Denormalizer/AppDenormalizer.php +++ b/src/Api/Management/Denormalizer/AppDenormalizer.php @@ -49,9 +49,9 @@ class AppDenormalizer extends EntityDenormalizer public function denormalize($data, $class, $format = null, array $context = []) { if (isset($data->developerId)) { - return parent::denormalize($data, $this->developerAppClass); + return parent::denormalize($data, $this->developerAppClass, $format, $context); } elseif (isset($data->companyName)) { - return parent::denormalize($data, $this->companyAppClass); + return parent::denormalize($data, $this->companyAppClass, $format, $context); } throw new UnexpectedValueException( 'Unable to denormalize because both "developerId" and "companyName" are missing from data.' @@ -68,6 +68,6 @@ public function supportsDenormalization($data, $type, $format = null) return false; } - return AppInterface::class === $type || $type instanceof AppInterface || in_array($type, class_implements(AppInterface::class)); + return AppInterface::class === $type || $type instanceof AppInterface || in_array(AppInterface::class, class_implements($type)); } } diff --git a/src/Controller/EntityListingControllerTrait.php b/src/Controller/EntityListingControllerTrait.php index 170613fe..bfebdc10 100644 --- a/src/Controller/EntityListingControllerTrait.php +++ b/src/Controller/EntityListingControllerTrait.php @@ -45,8 +45,7 @@ protected function responseArrayToArrayOfEntities(array $responseArray, string $ foreach ($responseArray as $item) { /** @var \Apigee\Edge\Entity\EntityInterface $tmp */ - $tmp = $this->getEntitySerializer()->denormalize($item, - $this->getEntityClass()); + $tmp = $this->getEntitySerializer()->denormalize($item, $this->getEntityClass()); $entities[$tmp->{$keyGetter}()] = $tmp; } diff --git a/src/Normalizer/EntityNormalizer.php b/src/Normalizer/EntityNormalizer.php index 49a165ac..9cb5c8b4 100644 --- a/src/Normalizer/EntityNormalizer.php +++ b/src/Normalizer/EntityNormalizer.php @@ -36,6 +36,26 @@ */ class EntityNormalizer implements NormalizerInterface, SerializerAwareInterface { + /** + * @var null|\Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface + */ + protected $classMetadataFactory; + + /** + * @var null|\Symfony\Component\Serializer\NameConverter\NameConverterInterface + */ + protected $nameConverter; + + /** + * @var null|\Symfony\Component\PropertyAccess\PropertyAccessorInterface + */ + protected $propertyAccessor; + + /** + * @var null|\Symfony\Component\PropertyInfo\PropertyInfoExtractor|\Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface + */ + protected $propertyTypeExtractor; + /** @var \Symfony\Component\Serializer\Normalizer\ObjectNormalizer */ private $objectNormalizer; @@ -75,6 +95,10 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory ] ); } + $this->classMetadataFactory = $classMetadataFactory; + $this->nameConverter = $nameConverter; + $this->propertyAccessor = $propertyAccessor; + $this->propertyTypeExtractor = $propertyTypeExtractor; $this->objectNormalizer = new ObjectNormalizer($classMetadataFactory, $nameConverter, $propertyAccessor, $propertyTypeExtractor); }