Repository navigation
Added
- Allow to disable group checking globally or per mapper, instead of only per property
- Add a
symfony/json-streamerintegration: the AutoMapper can now read and write JSON streams,
keeping all its mapping features available while streaming. Enable it in the bundle with the
json_streamer.enabledoption, which decorates the Symfony reader and writer and keeps them as a
fallback for the types the AutoMapper does not handle. Usejson_streamer.only_registered_mapping
to restrict it to the registered mappings. See the documentation - Add a
jsonside to the mappers, naming the JSON document itself symmetrically in both
directions: ajson-> class mapper reads a JSON stream, a class ->jsonmapper writes one.
Both are only reachable through the JsonStreamer integration,map()still refuses them - Add a
MapperContext::STREAMoption, to read and write collections without buffering them, so the
memory usage stays flat whatever the collection size - Add an
arrayLikeoption on the#[Mapper]attribute, to read or write a class as a keyed array
shape (dynamic keys,ArrayAccess, ...) instead of a typed object. The array-like decision is now
resolved once during metadata discovery and reused everywhere, instead of being guessed from the
source and target names
Changed
These are bug fixes, but they change the output of mappings that already worked:
- Convert between different backed enums through their backing value instead of copying the source instance
- Keep the concrete Symfony Uid subclass (e.g.
UuidV4) when copying a uid instead of building a baseUuid/Ulid - Keep the concrete date time subclass in date time to date time mapping instead of always building
DateTime/DateTimeImmutable - The
AutoMapperNormalizerno longer claims value objects handled by dedicated symfony normalizers (DateTimeInterface,BackedEnum,AbstractUid, etc.), which could produce a structure dump instead of the expected representation - The highest priority
Mapperattribute wins as documented, instead of the lowest
Fixed
- Resolve API Platform IRIs in every JSON format, not only JSON-LD, so a relation sent as an IRI on
application/jsonorapplication/merge-patch+jsonno longer reaches the mapper as a raw string - Use the
MapFromattribute reference instead ofMapTowhen resolving transformers inMapFromListener - Do not run a transformation on a null source value when the target is not nullable, a
TypeErroris thrown for typed properties instead of the transformation crashing on the null value - Create backed enum from scalar source value instead of assigning the raw scalar
- Normalize leading backslash in class names resolved from docblocks, fixing a parse error in generated mappers for global namespace classes and the
__PM__proxy name off-by-one - Implement
CheckTypeInterfaceon enum, date-time and uid transformers so union source types generate a runtime check for every branch - Unwrap nullable doctrine collection target type, items are mapped to the collection value type instead of plain arrays
- Capture the context in the
isAllowedAttributeclosure, fixingMapToContextcombined withskip_null_values - Guard nested property accessors (
parent.child) against null or uninitialized parent values on read, write and constructor paths, support private nested leaf properties and nullable parent types - Support variadic constructor parameters, values are spread as individual arguments and an absent variadic no longer throws
MissingConstructorArgumentsException - Correct identifier hashing: scalar identifiers are cast to string, object identifiers are hashed through their own mapper and
hash_finalno longer receives a string as its boolean argument, fixing mappers generated withstrictTypes: true - Atomic mapper file writes and locked registry updates in
FileLoader, fixing partially written files and lost registry entries under concurrency, the cache warmer no longer discards previously registered mapper hashes - Initialize
LazyMaponly once instead of re-running the mapping on every access - Align
Mapattributeifcondition semantics with symfony/object-mapper:if: falsenever maps the property, callables receive the value first and class levelMaptargets also match child classes - Do not register the cache warmer when the
evalloader is enabled, fixing container compilation withautomapper.loader.eval: true - Detect doctrine entities even when their metadata is not loaded yet, fixing missing provider and identifier on cold metadata factories
- Do not map static properties
- Guard a single matching union branch at runtime so a value of an unhandled union member is not blindly transformed
- Use the computed resource class in the API Platform JSON-LD context transformer instead of resolving it from a non-resource source (operator precedence fix)
- Only shorten an API Platform resource to its id for
arrayormixedtargets, avoiding aTypeErroron scalar targets - Allow
finalandstaticpublic getters to be used with#[MapToContext] - Run the object mapper listeners after the Doctrine and discriminator listeners in the bundle, so a
Map-attributed source class keeps its Doctrine provider and discriminator handling - The JsonStreamer integration no longer claims enums and uids, which were read as
nulland written as a structure dump ({"name":"FLAT","value":"flat"}) instead of being delegated to the Symfony reader and writer