mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
Update CommandDenormalizer to use API Platform name converter and handle null cases
This commit is contained in:
parent
55f2ea3d51
commit
1a954e88cd
2 changed files with 3 additions and 3 deletions
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
<service id="sylius_api.denormalizer.command" class="Sylius\Bundle\ApiBundle\Serializer\Denormalizer\CommandDenormalizer">
|
||||
<argument type="service" id="api_platform.serializer.normalizer.item" />
|
||||
<argument type="service" id="serializer.name_converter.metadata_aware" />
|
||||
<argument type="service" id="api_platform.name_converter" on-invalid="ignore" />
|
||||
<tag name="serializer.normalizer" />
|
||||
</service>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ final class CommandDenormalizer implements DenormalizerInterface
|
|||
{
|
||||
public function __construct(
|
||||
private DenormalizerInterface $itemNormalizer,
|
||||
private NameConverterInterface $nameConverter,
|
||||
private ?NameConverterInterface $nameConverter,
|
||||
) {
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +70,6 @@ final class CommandDenormalizer implements DenormalizerInterface
|
|||
|
||||
private function normalizeFieldName(string $field, string $class): string
|
||||
{
|
||||
return $this->nameConverter->normalize($field, $class);
|
||||
return $this->nameConverter ? $this->nameConverter->normalize($field, $class) : $field;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue