[PR #10169] Discriminator column generated value #12148

Open
opened 2026-01-22 16:13:04 +01:00 by admin · 0 comments
Owner

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

State: closed
Merged: No


Situation:

We have a Table which have a discriminator column with a generated value.

Expected:
If we persist a new Record of the mapped Entity, the Insert should not write the discriminator value because it is auto generated.

ISSUE:
The Insert tries to insert the default value of the entity. This will fail because the value can not be inserted if it is a generated column.

Solution:
This MR allows the dev to use generated Column as a discriminator column. If a new Entity should be persisted and the discriminator column has the generated Value set, the Insert will ignore the Value of the mapped column.


I need some help to write the correct Tests.
Please can you tell me if the solution is done in the right way?

**Original Pull Request:** https://github.com/doctrine/orm/pull/10169 **State:** closed **Merged:** No --- Situation: We have a Table which have a discriminator column with a generated value. Expected: If we persist a new Record of the mapped Entity, the Insert should not write the discriminator value because it is auto generated. ISSUE: The Insert tries to insert the default value of the entity. This will fail because the value can not be inserted if it is a generated column. Solution: This MR allows the dev to use generated Column as a discriminator column. If a new Entity should be persisted and the discriminator column has the generated Value set, the Insert will ignore the Value of the mapped column. --------------------------------------- I need some help to write the correct Tests. Please can you tell me if the solution is done in the right way?
admin added the pull-request label 2026-01-22 16:13:04 +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#12148