Skip to content

[Serializer] when normalizing, order the properties in a way controllable by the user #27441

Closed as not planned
@dkarlovi

Description

@dkarlovi

Description
Currently, when normalizing, the serializer seems to order the properties in the same way it discovers them (guessing, reflection-based?). If possible, ot would make sense to use the order as supplied by the user.

Example

With classes:

class A {
    public $a;
    public $b;
    public $c;
}

class B extends A {
    public $d;
    public $e;
}

with config:

<?xml version="1.0" ?>
<serializer>
    <class name="B">
        <attribute name="a"/>
        <attribute name="b"/>
        <attribute name="c"/>
        <attribute name="d"/>
        <attribute name="e"/>
    </class>
</serializer>

I would expect it to come out normalized in the exact order specified in the mapping.

Instead, it comes out as:

d:
e:
a:
b:
c:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions