8000 [Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed by dunglas · Pull Request #24563 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed #24563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[Serializer] ObjectNormalizer: throw if PropertyAccess isn't installed
  • Loading branch information
dunglas committed Oct 15, 2017
commit 184e57436e99fa4255aa3a2593f12f326eed2752
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Symfony\Component\Serializer\Exception\CircularReferenceException;
use Symfony\Component\Serializer\Exception\LogicException;
use Symfony\Component\Serializer\Exception\RuntimeException;
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface;
use Symfony\Component\Serializer\NameConverter\NameConverterInterface;

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

public function __construct(ClassMetadataFactoryInterface $classMetadataFactory = null, NameConverterInterface $nameConverter = null, PropertyAccessorInterface $propertyAccessor = null)
{
if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccess')) {
throw new RuntimeException('Unable to use ObjectNormalizer as the Symfony PropertyAcess component is not installed.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PropertyAccess

}

parent::__construct($classMetadataFactory, $nameConverter);

$this->propertyAccessor = $propertyAccessor ?: PropertyAccess::createPropertyAccessor();
Expand Down
0