partials and shared objects between queries #5415

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

Originally created by @eventhorizonpl on GitHub (Feb 13, 2017).

Originally assigned to: @Ocramius on GitHub.

Hi,

I don't know if it's a bug or optimization feature.

Lets say that I've got a Post entity and User entity.

In one query I do something like this:

->select('partial p.{id,slug,title}, partial pu.{id,username}') ->from('Post', 'p') ->leftJoin('p.user', 'pu')

and I've got another query in the same action and I do something like this

->select('partial u.{id,username,slug}') ->from('User', 'u')

The problem is that in result list of second query I'm getting a 1 user without slug. This object looks like it was taken from Post query.

I guess that it's caused by some internal doctrine optimization. But I don't know if it's a feature or a bug.

Without using partial queries you will not notice any problem.

Best regards,
Michal

Originally created by @eventhorizonpl on GitHub (Feb 13, 2017). Originally assigned to: @Ocramius on GitHub. Hi, I don't know if it's a bug or optimization feature. Lets say that I've got a Post entity and User entity. In one query I do something like this: ` ->select('partial p.{id,slug,title}, partial pu.{id,username}') ->from('Post', 'p') ->leftJoin('p.user', 'pu') ` and I've got another query in the same action and I do something like this ` ->select('partial u.{id,username,slug}') ->from('User', 'u') ` The problem is that in result list of second query I'm getting a 1 user without slug. This object looks like it was taken from Post query. I guess that it's caused by some internal doctrine optimization. But I don't know if it's a feature or a bug. Without using partial queries you will not notice any problem. Best regards, Michal
admin added the BugInvalidQuestion labels 2026-01-22 15:07:12 +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#5415