-
-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
Description
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.