api-platform / api-platform/core

Add updatable to ApiProperty

未關閉
#5,962 4 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 2 小時
30 天內合併 PR
51

描述

**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**

```php
class Foo {
#[ApiProperty(writable: false, updateable:true)]
private ?Bar bar = null;
}
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。