8000 bug #24563 [Serializer] ObjectNormalizer: throw if PropertyAccess isn… · symfony/symfony@7dac168 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7dac168

Browse files
committed
bug #24563 [Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed (dunglas)
This PR was squashed before being merged into the 2.7 branch (closes #24563). Discussion ---------- [Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes | Fixed tickets | #24553 | License | MIT | Doc PR | n/a Commits ------- b5246a7 [Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed
2 parents 60adbdd + b5246a7 commit 7dac168

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/Serializer/Normalizer/ObjectNormalizer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
1717
use Symfony\Component\Serializer\Exception\CircularReferenceException;
1818
use Symfony\Component\Serializer\Exception\LogicException;
19+
use Symfony\Component\Serializer\Exception\RuntimeException;
1920
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
2021
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;
2122

@@ -33,6 +34,10 @@ class ObjectNormalizer extends AbstractNormalizer
3334

3435
public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null)
3536
{
37+
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccess')) {
38+
throw new RuntimeException('The ObjectNormalizer class requires the "PropertyAccess" component. Install "symfony/property-access" to use it.');
39+
}
40+
3641
parent::__construct($classMetadataFactory, $nameConverter);
3742

3843
$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();

0 commit comments

Comments
 (0)
0