Repository navigation
Map the data with class transformers and remove the CoreExtension - #217
Merged
Merged
Conversation
The TransformMiddleware is replaced by a ClassTransformer which the hydrator calls after the last middleware, or directly if no middleware runs for a class. Transformers come from a ClassTransformerFactory, the builder chains the registered factories and always ends with the ReflectionTransformerFactory. The builder also always adds the BuiltInGuesser as last guesser, so the CoreExtension had nothing left to do and is removed. MissingMiddlewares, AllMiddlewaresSkipped, NoMoreMiddleware and PRIORITY_TRANSFORM can not happen or have no effect anymore and are removed.
|
Hello 👋 here is the most recent benchmark result:
This comment gets update everytime a new commit comes in! |
DanielBadura
approved these changes
Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The property mapping is no longer a middleware. After the last middleware,
Nextcalls theClassTransformerof the class, and if no middleware runs for a class at all, the hydrator calls the transformer directly without creating aNext.Transformers come from a
ClassTransformerFactory. Factories are registered withStackHydratorBuilder::addTransformerFactory(), the builder chains them in aChainTransformerFactoryand always appends theReflectionTransformerFactory, so reflection is just the last factory instead of a hidden fallback. This is the extension point the generated code from #214 will plug into later. TheStackHydratoritself takes a single factory and defaults to reflection.The builder now also always appends the
BuiltInGuesserafter the registered guessers, like theAttributeMetadataFactoryalready did without the builder. With that theCoreExtensionhad nothing left to register and is removed.new StackHydrator()and(new StackHydratorBuilder())->build()behave the same without registering anything.Removed, since they can not happen or have no effect anymore:
TransformMiddleware(its code lives on in theReflectionTransformer)CoreExtensionMissingMiddlewares,AllMiddlewaresSkipped,NoMoreMiddlewareExtension::PRIORITY_TRANSFORMThe
ReflectionTransformeronly unsetsOBJECT_TO_POPULATEfrom the context when it is set.unset()copies the array even if the key is missing, and since #215 the context always contains the hydrator, so this saved a copy per object.ClassTransformerFactory::create()only gets the metadata for now. The generated transformers will need more (metadata of nested classes, the middlewares), I would extend that together with the codegen PR instead of guessing now.The upgrade guide covers the removal of the
CoreExtension, theTransformMiddlewareand the exceptions.