Skip to content

Conversation

@kbond
Copy link
Member

@kbond kbond commented Aug 9, 2022

Q A
Bug fix? yes
New feature? no
Tickets Fix #414
License MIT

@kbond kbond force-pushed the live-enum-support branch from e05cd38 to bfd7f8d Compare August 10, 2022 17:16
$value = $component->$method($dehydratedValue);
} elseif ($property->getType() instanceof \ReflectionNamedType && !$property->getType()->isBuiltin()) {
$value = $this->normalizer->denormalize($value, $property->getType()->getName(), 'json', [self::LIVE_CONTEXT => true]);
} elseif (!$value && $type && $type->allowsNull() && is_a($type->getName(), \BackedEnum::class, true) && !\in_array($value, array_map(fn (\BackedEnum $e) => $e->value, $type->getName()::cases()))) {
Copy link
Member

Choose a reason for hiding this comment

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

This feels a bit specific or heavy-handed, as we discussed. But I think we should do it... if nothing else to see if this fixes things or helps us discover more use-cases so we can get this just right.

@weaverryan
Copy link
Member

Thanks Kevin!

@weaverryan weaverryan merged commit 5893aca into symfony:2.x Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[LiveComponent] Incorrect handling of nullable enum types

2 participants