Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3924

Symfony forms : Set an embedded field to null

$
0
0

Hy,

I'm on Symfony with MongoDb. I have a problem when I want update a document. This one has an embedded field. If I give it a not null value on POST, I can't update it to null when I patch.

When I POST :

"destination": {
  "address1": "my address"
}

I have a good response :

"destination": {
  "address1": "my address"
}

But when I want PATCH to null :

"destination": null

I always have :

"destination": {
  "address1": "my address"
}

For PATCH I use Form Builder with my own FormType, I have this :

->add('destination', DestinationType::class, [
   'required' => false,
])

And it's Ok for not embedded fields

Thank's


Viewing all articles
Browse latest Browse all 3924

Trending Articles