-
-
Notifications
You must be signed in to change notification settings - Fork 340
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
[LiveComponent] make serializer optional #1327
[LiveComponent] make serializer optional #1327
Conversation
WebMamba
commented
Dec 10, 2023
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
Issues | |
License | MIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great chore to get done!
@@ -374,8 +378,6 @@ private function dehydrateValue(mixed $value, LivePropMetadata $propMetadata, ob | |||
} | |||
|
|||
if (!$this->isValueValidDehydratedValue($value)) { | |||
$badKeys = $this->getNonScalarKeys($value, $propMetadata->getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this getNonScalarKeys()
is now also unused, so let's remove that too :)
@@ -354,6 +354,10 @@ private function dehydrateValue(mixed $value, LivePropMetadata $propMetadata, ob | |||
} | |||
|
|||
if ($propMetadata->useSerializerForHydration()) { | |||
if (!interface_exists(NormalizerInterface::class)) { | |||
throw new \LogicException(sprintf('The LiveProp "%s" on component "%s" is using the serializer to hydrate, but the Serializer component is not installed. Try running "composer require symfony/serializer".', $propMetadata->getName(), $parentObject::class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's mention the specific option name:
throw new \LogicException(sprintf('The LiveProp "%s" on component "%s" is using the serializer to hydrate, but the Serializer component is not installed. Try running "composer require symfony/serializer".', $propMetadata->getName(), $parentObject::class)); | |
throw new \LogicException(sprintf('The LiveProp "%s" on component "%s" has "useSerializerForHydration: true" but the Serializer component is not installed. Try running "composer require symfony/serializer".', $propMetadata->getName(), $parentObject::class)); |
92518df
to
a6f00ea
Compare
Thanks Matheo~ |
…ializer (smnandre) This PR was squashed before being merged into the 2.x branch. Discussion ---------- [LiveComponent] Make LiveComponentHydrator work without Serializer | Q | A | ------------- | --- | Bug fix? | yes | New feature? | yes | License | MIT Allow nullable "serializer" argument in LiveComponentHydrator constructor. (fix #1340 and complete #1327) Commits ------- 10ca442 [LiveComponent] Make LiveComponentHydrator work without Serializer