W3cubDocs

/Symfony 4.1

ObjectToPopulateTrait

trait ObjectToPopulateTrait

Methods

object|null extractObjectToPopulate(string $class, array $context, string $key = null)

Extract the object_to_populate field from the context if it exists and is an instance of the provided $class.

Details

protected object|null extractObjectToPopulate(string $class, array $context, string $key = null)

Extract the object_to_populate field from the context if it exists and is an instance of the provided $class.

Parameters

string $class The class the object should be
array $context The denormalization context
string $key They in which to look for the object to populate. Keeps backwards compatibility with AbstractNormalizer.

Return Value

object|null an object if things check out, null otherwise

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Serializer/Normalizer/ObjectToPopulateTrait.html