Skip to content

Inline virtual property #1558

@Bilge

Description

@Bilge
Q A
Bug report? yes
Feature request? yes
BC Break report? no
RFC? no

How is one supposed to inline a virtual property? The following does not work:

#[Serializer\VirtualProperty(name: 'xD', exp: 'object.format("c")', options: [[Serializer\Inline::class, []]])]
class Foo extends \DateTimeImmutable { ... }

(Aside, it shouldn't be necessary to specify a name for an inlined property, nor should it be necessary to specify an empty array after the inline class).

Expected Result

  • {Foo: "2026-12-31T12:30:00+00:00"}

Actual Result

  • {Foo: {}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions