Skip to content

Commit

Permalink
[JMS] allow v5
Browse files Browse the repository at this point in the history
  • Loading branch information
dpfaffenbauer committed Dec 21, 2023
1 parent 974ea34 commit c015868
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"doctrine/orm": "^2.9",
"fakerphp/faker": "^1.16",
"gedmo/doctrine-extensions": "^3.11",
"jms/serializer-bundle": "^4.0",
"jms/serializer-bundle": "^4.0 | ^5.0",
"knplabs/knp-menu-bundle": "^3.1",
"laminas/laminas-stdlib": "^3.6",
"laminas/laminas-zendframework-bridge": "^1.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ services:
- '@translator'

CoreShop\Bundle\ResourceBundle\Serialization\Driver\PimcoreDataObjectDriver:
decorates: 'jms_serializer.metadata.annotation_driver'
decorates: 'jms_serializer.metadata_driver'
arguments:
- '@CoreShop\Bundle\ResourceBundle\Serialization\Driver\PimcoreDataObjectDriver.inner'

Expand All @@ -89,7 +89,6 @@ services:
decorates: 'jms_serializer.object_constructor'
arguments:
- '@CoreShop\Bundle\ResourceBundle\Serialization\VersionObjectConstructor.inner'
- '@jms_serializer.unserialize_object_constructor'

CoreShop\Component\Resource\Service\FolderCreationServiceInterface: '@CoreShop\Component\Resource\Service\FolderCreationService'
CoreShop\Component\Resource\Service\FolderCreationService:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class VersionObjectConstructor implements ObjectConstructorInterface
{
public function __construct(
private ObjectConstructorInterface $fallbackConstructor,
private ObjectConstructorInterface $fallbacksFallbackConstructor,
private string $fallbackStrategy = DoctrineObjectConstructor::ON_MISSING_FALLBACK,
private ?\JMS\Serializer\Exclusion\ExpressionLanguageExclusionStrategy $expressionLanguageExclusionStrategy = null,
) {
Expand Down Expand Up @@ -98,7 +97,7 @@ public function construct(DeserializationVisitorInterface $visitor, ClassMetadat
}

if (array_key_exists('id', $identifierList) && !$identifierList['id']) {
return $this->fallbacksFallbackConstructor->construct($visitor, $metadata, $data, $type, $context);
return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context);
}

// Entity update, load it from database
Expand All @@ -111,7 +110,7 @@ public function construct(DeserializationVisitorInterface $visitor, ClassMetadat
case DoctrineObjectConstructor::ON_MISSING_EXCEPTION:
throw new ObjectConstructionException(sprintf('Entity %s can not be found', $metadata->name));
case DoctrineObjectConstructor::ON_MISSING_FALLBACK:
return $this->fallbacksFallbackConstructor->construct($visitor, $metadata, $data, $type, $context);
return $this->fallbackConstructor->construct($visitor, $metadata, $data, $type, $context);
default:
throw new InvalidArgumentException('The provided fallback strategy for the object constructor is not valid');
}
Expand Down
2 changes: 1 addition & 1 deletion src/CoreShop/Bundle/ResourceBundle/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"require": {
"doctrine/orm": "^2.9",
"doctrine/doctrine-bundle": "^2.4",
"jms/serializer-bundle": "^4.0",
"jms/serializer-bundle": "^4.0 | ^5.0",
"stof/doctrine-extensions-bundle": "^1.6",
"coreshop/pimcore-bundle": "^4.0",
"coreshop/locale-bundle": "^4.0",
Expand Down

0 comments on commit c015868

Please sign in to comment.