class UnwrappingDenormalizerContextBuilder
A helper providing autocompletion for available UnwrappingDenormalizer options.
@author Mathias Arlaud <mathias.arlaud@gmail.com>
Hierarchy
- class \Symfony\Component\Serializer\Context\Normalizer\UnwrappingDenormalizerContextBuilder implements \Symfony\Component\Serializer\Context\ContextBuilderInterface uses \Symfony\Component\Serializer\Context\ContextBuilderTrait
Expanded class hierarchy of UnwrappingDenormalizerContextBuilder
File
-
vendor/
symfony/ serializer/ Context/ Normalizer/ UnwrappingDenormalizerContextBuilder.php, line 26
Namespace
Symfony\Component\Serializer\Context\NormalizerView source
final class UnwrappingDenormalizerContextBuilder implements ContextBuilderInterface {
use ContextBuilderTrait;
/**
* Configures the path of wrapped data during denormalization.
*
* Eg: [foo].bar[bar]
*
* @see https://symfony.com/doc/current/components/property_access.html
*
* @throws InvalidArgumentException
*/
public function withUnwrapPath(?string $unwrapPath) : static {
if (null === $unwrapPath) {
return $this->with(UnwrappingDenormalizer::UNWRAP_PATH, null);
}
try {
new PropertyPath($unwrapPath);
} catch (InvalidPropertyPathException $e) {
throw new InvalidArgumentException(\sprintf('The "%s" property path is not valid.', $unwrapPath), previous: $e);
}
return $this->with(UnwrappingDenormalizer::UNWRAP_PATH, $unwrapPath);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ContextBuilderTrait::$context | private | property | |
ContextBuilderTrait::toArray | public | function | |
ContextBuilderTrait::with | protected | function | |
ContextBuilderTrait::withContext | public | function | |
UnwrappingDenormalizerContextBuilder::withUnwrapPath | public | function | Configures the path of wrapped data during denormalization. |