api-platform / api-platform/core

Add updatable to ApiProperty

Abierto
#5,962 4 comentarios 2 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
2.6k
Forks
980
Merge medio
2 d 4 h
PR fusionados (30 d)
49

Descripción

**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;
}
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.