Add updatable to ApiProperty
Description
We currently have writable and 'readable' on ApiProperty attributes.
This is great to reduce the amount of serialization group management you have to juggle.
You'll run into an issue when you try to have fields that are writable but ONLY during updates (PATCH, PUT), in cases like this you'd have to start adding serialization groups again, which is a bit annoying when you try to serialize objects as well as you then have to propagate that down.
I'd suggest adding an updateable field to ApiProperty that'll only include/exclude fields based on if it's a PUSH or POST operation.
Example
class Foo {
#[ApiProperty(writable: false, updateable:true)]
private ?Bar bar = null;
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'd still like something like that, so not stale
okay added the enhancement label, I think that you should use a DTO for each of the use cases so that you can have writable only for PATCH
You could yeah.
I've run into this while using the setup with Micro Mapper Ryan introduced in https://symfonycasts.com/screencast/api-platform-extending .
It mainly enabled me to seperate it in that way, but using it I've run into the "need" for an updatable only property to keep it "simple"