DiscriminatorColumn inside Partial Object #5611

Open
opened 2026-01-22 15:12:38 +01:00 by admin · 2 comments
Owner

Originally created by @danielspk on GitHub (Jul 18, 2017).

When requesting a partial object in a DQL query the discriminator column is returned.

$results = $em->createQuery("SELECT partial.{id, name} FROM Entity:ChildA")->getArrayResult();

The array results contains the keys: id, name and type - (type was not requested).

Entity configuration:

@InheritanceType("SINGLE_TABLE")
@DiscriminatorColumn(name="type", type="integer")
@DiscriminatorMap({
  "1" = "Entity\ChildA",
  "2" = "Entity\ChildB",
  "3" = "Entity\ChildC"
})
Originally created by @danielspk on GitHub (Jul 18, 2017). When requesting a partial object in a DQL query the discriminator column is returned. ``` $results = $em->createQuery("SELECT partial.{id, name} FROM Entity:ChildA")->getArrayResult(); ``` The array results contains the keys: id, name and type - **(type was not requested)**. Entity configuration: ``` @InheritanceType("SINGLE_TABLE") @DiscriminatorColumn(name="type", type="integer") @DiscriminatorMap({ "1" = "Entity\ChildA", "2" = "Entity\ChildB", "3" = "Entity\ChildC" }) ```
admin added the BugMissing Tests labels 2026-01-22 15:12:38 +01:00
Author
Owner

@Ocramius commented on GitHub (Jul 18, 2017):

I didn't even know that array selection was possible with partial entity queries in DQL: nice catch!

@Ocramius commented on GitHub (Jul 18, 2017): I didn't even know that array selection was possible with partial entity queries in DQL: nice catch!
Author
Owner

@danielspk commented on GitHub (Aug 18, 2020):

Hi.

Where can I start to analyze the error?

@danielspk commented on GitHub (Aug 18, 2020): Hi. Where can I start to analyze the error?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5611