Fetch EAGER ManyToOne nullable relation cannot be nulled during PUT or PATCH operation
API Platform version(s) affected: 3.2.16
Description
Entities with ORM\ManyToOne(fetch: 'EAGER') nullable relation can be setted during a PUT or PATCH with an IRI, but cannot be nulled.
If I remove fetch: 'EAGER', I can set relation to null.
How to reproduce
With EAGER fetch
#[ORM\ManyToOne(targetEntity: File::class, fetch: 'EAGER')]
#[ORM\JoinColumn(name:'image_id', nullable: true, onDelete: 'SET NULL')]
#[Groups(['block:read', 'block:write', 'webPage:single:read'])]
#[ApiProperty(description: 'File IRI reference', example: '/api/files/1ee8859e-d2fd-6bda-ae37-d9341637fbc1')]
private ?File $image = null;
When I inspect request in Symfony Profiler: previous_data contains an image but data too !
Without EAGER fetch
#[ORM\ManyToOne(targetEntity: File::class)]
#[ORM\JoinColumn(name: 'image_id', nullable: true, onDelete: 'SET NULL')]
#[Groups(['content:read', 'content:write'])]
#[ApiProperty(description: 'File IRI reference', example: '/api/files/1ee8859e-d2fd-6bda-ae37-d9341637fbc1')]
private ?File $image = null;
When I inspect request in Symfony Profiler: previous_data contains an image then data has null image
can you provide a reproducer ?
can you provide a reproducer ?
I'll make that. Male or female ? For the reproducer :rofl:
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.