diff --git a/.github/workflows/recipe.yaml b/.github/workflows/recipe.yaml index 6e2bb39e..b57c6438 100644 --- a/.github/workflows/recipe.yaml +++ b/.github/workflows/recipe.yaml @@ -27,11 +27,14 @@ jobs: steps: - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: date.timezone=UTC + + - name: Set project php-version run: | - sudo update-alternatives --set php /usr/bin/php${{ matrix.php }} - echo "date.timezone=UTC" >> /tmp/timezone.ini - sudo mv /tmp/timezone.ini /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini - echo ${{ matrix.php }} > .php-version + echo "${{ matrix.php }}" > .php-version - uses: actions/checkout@v2 with: diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 99160cb1..0f8e85b6 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -21,9 +21,13 @@ jobs: - uses: actions/checkout@v2 - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: date.timezone=UTC + + - name: Set project php-version run: | - sudo update-alternatives --set php /usr/bin/php${{ matrix.php }} - echo "date.timezone=UTC" | sudo tee /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini echo "${{ matrix.php }}" > .php-version - uses: actions/cache@v1 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f266e879..14694f5f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -28,9 +28,13 @@ jobs: node-version: '14' - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: date.timezone=UTC + + - name: Set project php-version run: | - sudo update-alternatives --set php /usr/bin/php${{ matrix.php }} - echo "date.timezone=UTC" | sudo tee /etc/php/${{ matrix.php }}/cli/conf.d/timezone.ini echo "${{ matrix.php }}" > .php-version - name: Install symfony CLI diff --git a/src/Normalizer/Product/ProductDTONormalizer.php b/src/Normalizer/Product/ProductDTONormalizer.php index 479379d7..24532387 100644 --- a/src/Normalizer/Product/ProductDTONormalizer.php +++ b/src/Normalizer/Product/ProductDTONormalizer.php @@ -63,13 +63,13 @@ public function denormalize($data, string $type, string $format = null, array $c /** @var EaterInterface $object */ $object = parent::denormalize($data, $type, $format, $context); - if (\array_key_exists('main_taxon', $data)) { + if (\array_key_exists('main_taxon', $data) && null !== $data['main_taxon']) { $taxonDTOClass = $this->automapperConfiguration->getTargetClass('taxon'); $object->setData('main_taxon', $this->denormalizer->denormalize($data['main_taxon'], $taxonDTOClass, 'json', $context)); unset($data['main_taxon']); } - if (\array_key_exists('product_taxons', $data)) { + if (\array_key_exists('product_taxons', $data) && null !== $data['product_taxons']) { $values = []; $productTaxonDTOClass = $this->automapperConfiguration->getTargetClass('product_taxon'); foreach ($data['product_taxons'] as $value) { @@ -89,7 +89,7 @@ public function denormalize($data, string $type, string $format = null, array $c unset($data['product_taxons']); } - if (\array_key_exists('channels', $data)) { + if (\array_key_exists('channels', $data) && null !== $data['channels']) { $values = []; $channelDTOClass = $this->automapperConfiguration->getTargetClass('channel'); foreach ($data['channels'] as $value) { @@ -99,7 +99,7 @@ public function denormalize($data, string $type, string $format = null, array $c unset($data['channels']); } - if (\array_key_exists('attributes', $data)) { + if (\array_key_exists('attributes', $data) && null !== $data['attributes']) { $values = []; $productAttributeDTOClass = $this->automapperConfiguration->getTargetClass('product_attribute'); foreach ($data['attributes'] as $key => $value) { @@ -109,7 +109,7 @@ public function denormalize($data, string $type, string $format = null, array $c unset($data['channels']); } - if (\array_key_exists('prices', $data)) { + if (\array_key_exists('prices', $data) && null !== $data['prices']) { $values = []; $pricingDTOClass = $this->automapperConfiguration->getTargetClass('pricing'); foreach ($data['prices'] as $key => $value) {