Skip to content

standard_put: false Doesn't work for Embeddables #6914

@ostrolucky

Description

@ostrolucky

API Platform version(s) affected: 4.0.14

Description
With standard_put: false, I expect that missing fields would not be reset to NULL. However, this is not true for Embeddables.

How to reproduce

#[ApiResource()]
#[ORM\Entity()
class DatasyncConnector {
    #[ORM\Embedded(Embeddable::class)]
    public ?Embeddable $embeddable = null;
}

#[ORM\Embeddable()]
class MicrosoftGraph
{
    #[ORM\Column(type: 'guid', nullable: true)]
    public string $clientId;
    #[ORM\Column(nullable: true)]
    public ?string $clientSecret = null;
}

If you send payload

{"embeddable": {"client_id": "foo", "client_secret": "bar"}}

And afterwards

{"embeddable": {"client_id": "foo"}}

client_secret would be set to NULL. Expectation is that client_secret would preserve previous value (bar).

Possible Solution

Additional Context
I've not inspected if this is in general problem with any nested objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions