[PR #1275] [WIP] Nullable embedded objects. #9331

Closed
opened 2026-01-22 16:03:59 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/1275

State: closed
Merged: No


The idea was to have a simple (and clean) way to override the nullable property of embedded objects, so I've
added the nullable attribute on the @Embedded annotation and it have 3 possible values:

  • NULL: The nullable option that was defined on the attributes of the embeddable class won't be overriden;
  • TRUE: All attributes of the embeddable class will be marked as nullable and the embeddable instance only would be created when data is not NULL;
  • FALSE: All attributes of the embeddable class will be marked as non-nullable.

There's a lot of things to be improved (mostly on UnitOfWork), but it's fully working with basic tests as you can see on ValueObjectsTest::testCRUDOfNullableEmbedded() case.

I would appreciate a lot your opinions!

**Original Pull Request:** https://github.com/doctrine/orm/pull/1275 **State:** closed **Merged:** No --- The idea was to have a simple (and clean) way to override the nullable property of embedded objects, so I've added the `nullable` attribute on the `@Embedded` annotation and it have 3 possible values: - NULL: The nullable option that was defined on the attributes of the embeddable class won't be overriden; - TRUE: All attributes of the embeddable class will be marked as nullable and the embeddable instance only would be created when data is not NULL; - ~~FALSE: All attributes of the embeddable class will be marked as non-nullable.~~ There's a lot of things to be improved (mostly on UnitOfWork), but it's fully working with basic tests as you can see on ValueObjectsTest::testCRUDOfNullableEmbedded() case. I would appreciate a lot your opinions!
admin added the pull-request label 2026-01-22 16:03:59 +01:00
admin closed this issue 2026-01-22 16:04:00 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#9331