Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-4018

'CompoundMatcherNormalizer' denormalizes every object when using Symfony Serializer

    XMLWordPrintable

Details

    • Ibexa Open Source

    Description

      Currently when denormalizing data CompoundMatcherNormalizer has a high priority and no supportDenormalization method which makes it chosen as a first denormalizer when denormalizing objects.

      For example:

      class TokenDeserializer
      {
          private $serializer;
      
          public function __construct(SerializerInterface $serializer) {
              $this->serializer = $serializer;
          }
      
          public function getToken(): Token
          {
              $json = '{"token": "1234567890"}';
      
              return $this->serializer->deserialize($json, Token::class, 'json');
          }
      }
      

      and having:

      class Token
      {
          #[SerializedName('token')]
          private string $token;
      
          public function getAccessToken(): string
          {
              return $this->token;
          }
      
          public function setAccessToken(string $token): void
          {
              $this->token = $token;
          }
      }
      

      will result in a Token being denormalized as null.

      Expected result:
      Deserialized token should be an object of class Token.

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              bartlomiej.wajda@ibexa.co Bartłomiej Wajda
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: