We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
ORM\ManyToOne(fetch: 'EAGER')
PUT
PATCH
If I remove fetch: 'EAGER', I can set relation to null.
fetch: 'EAGER'
null
How to reproduce
#[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 !
image
data
#[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
The text was updated successfully, but these errors were encountered:
can you provide a reproducer ?
Sorry, something went wrong.
I'll make that. Male or female ? For the reproducer 🤣
No branches or pull requests
API Platform version(s) affected: 3.2.16
Description
Entities with
ORM\ManyToOne(fetch: 'EAGER')
nullable relation can be setted during aPUT
orPATCH
with an IRI, but cannot be nulled.If I remove
fetch: 'EAGER'
, I can set relation tonull
.How to reproduce
With EAGER fetch
When I inspect request in Symfony Profiler: previous_data contains an
image
butdata
too !Without EAGER fetch
When I inspect request in Symfony Profiler: previous_data contains an
image
thendata
hasnull
imageThe text was updated successfully, but these errors were encountered: