You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #263 [Live] migrate Hydration system to standard Symfony normalizers (kbond)
This PR was merged into the 2.x branch.
Discussion
----------
[Live] migrate Hydration system to standard Symfony normalizers
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| Tickets | n/a
| License | MIT
This removes our custom hydration system and uses `symfony/serializer` directly. Hydrators are now just (de)normalizer's registered with Symfony as normal.
The serializer context (`['live-component' => true]`) can be used to restrict (de)normalizers to just live component properties.
Commits
-------
fd39e9d [WIP][Live] migrate Hydration system to standard Symfony normalizers
if (is_scalar($value) || \is_array($value) || null === $value) {
270
-
// nothing to dehydrate...
271
-
return$value;
272
-
}
273
-
274
-
foreach ($this->propertyHydratorsas$hydrator) {
275
-
try {
276
-
$value = $hydrator->dehydrate($value);
277
-
278
-
break;
279
-
} catch (UnsupportedHydrationException$e) {
280
-
continue;
281
-
}
282
-
}
283
-
284
-
if (!is_scalar($value) && !\is_array($value) && null !== $value) {
285
-
thrownew \LogicException(sprintf('Cannot dehydrate property "%s" of "%s". The value "%s" does not have a dehydrator.', $name, \get_class($component), get_debug_type($value)));
286
-
}
287
-
288
-
return$value;
289
-
}
290
-
291
237
/**
292
238
* Transforms a path like `post.name` into `[post][name]`.
0 commit comments