DDC-3855: Inheritance JOINED, left select child entity retrieves not valid object #4723

Open
opened 2026-01-22 14:48:21 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Jul 30, 2015).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user mplaton:

Delivery is child of inheritance parent Place. If delivery not set in query, result will have array of PlaceAddress entities, because PlaceAddress is a root alias, but when delivery added to select, then result will contain array of PlaceTypeDelivery but root alias stays PlaceAddress. Is this a bug?

$this->_em
->createQueryBuilder()
->select(['partial addresses.{id,realAddress,phone}','place','partial workday.{id}','partial delivery.{id}'])
->from('CommonBundle:PlaceAddress', 'addresses')
->leftJoin("addresses.place", "place", "WITH", "addresses.place = place.id")
->leftJoin("addresses.workday", "workday", "WITH", "workday.address = addresses.id")
->where("place INSTANCE OF CommonBundle:PlaceTypeDelivery")
->andWhere("place.enabled = 1");

Originally created by @doctrinebot on GitHub (Jul 30, 2015). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user mplaton: Delivery is child of inheritance parent Place. If delivery not set in query, result will have array of PlaceAddress entities, because PlaceAddress is a root alias, but when delivery added to select, then result will contain array of PlaceTypeDelivery but root alias stays PlaceAddress. Is this a bug? $this->_em ->createQueryBuilder() ->select(['partial addresses.{id,realAddress,phone}','place','partial workday.{id}','partial delivery.{id}']) ->from('CommonBundle:PlaceAddress', 'addresses') ->leftJoin("addresses.place", "place", "WITH", "addresses.place = place.id") ->leftJoin("addresses.workday", "workday", "WITH", "workday.address = addresses.id") ->where("place INSTANCE OF CommonBundle:PlaceTypeDelivery") ->andWhere("place.enabled = 1");
admin added the Bug label 2026-01-22 14:48:21 +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#4723