Skip to content

Entirely disable use of Provider on embedded resource #5544

@MariusJam

Description

@MariusJam

Description

Hi,

in some cases, we would need to be able to entirely disable the use of a provider for an embedded resource for a POST request. But, as soon as we provide the embedded resource's $id, we fall into this condition and the provider is used. Would that be possible to add a way to force a simple denormalization of the data provided in the post request rather than use the provider?

Example

In a proxy use case (no ORM used) :

<?php

#[ApiResource]
class Foo {
 public int $id;
 public string $name;
}
<?php

#[ApiResource]
class Bar {
 public int $id;

  #[ApiProperty(writableLink: true)]
 public Foo $foo;
}

Making a POST on /bars with {"foo: {"id": 1, "name": "SuperName"}} will fail with a Provider not found on operation... error. Whereas the same POST request without id: {"foo: {"name": "SuperName"}} will succeed.

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