Skip to content

Avoid mutating Translation objects in TranslatableTransformer::transform #14

Description

@javihgil

Problem

TranslatableTransformer::transform() writes to $value['_default'] before checking whether $value is a Translation object.

Because Translation implements ArrayAccess, this mutates the in-memory translation payload and adds _default to the stored translations array.

Current behavior

Transforming a Translation object for the form layer can leave the object mutated with internal form metadata inside translations.

Expected behavior

The transformer should normalize form data without mutating the original Translation object.

Notes

This was reproduced locally by transforming a Translation object and then checking getTranslations(), which contained _default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions