DDC-624: Partial object query that leaves out an association to avoid loading it fetches the association anyway. #772

Closed
opened 2026-01-22 12:49:54 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Jun 3, 2010).

Originally assigned to: @guilhermeblanco on GitHub.

Jira issue originally created by user romanb:

Assuming:

Customer Cart

where Cart is the owning side.

Since the association from Customer to Cart can not be lazy, it would make sense to leave out the association in a query to avoid loading the carts like this:

select partial c.{id,name, ... anything except cart} from Customer c"

But this is ignored and the carts of all customers are fetched anyway. Query::HINT_FORCE_PARTIAL_LOAD is an alternative solution, however it has the disadvantage that it disables lazy-loading for all queried objects. If partial querying would honor associations this would allow more fine-grained control.

Originally created by @doctrinebot on GitHub (Jun 3, 2010). Originally assigned to: @guilhermeblanco on GitHub. Jira issue originally created by user romanb: Assuming: Customer <onetoone> Cart where Cart is the owning side. Since the association from Customer to Cart can not be lazy, it would make sense to leave out the association in a query to avoid loading the carts like this: ``` select partial c.{id,name, ... anything except cart} from Customer c" ``` But this is ignored and the carts of all customers are fetched anyway. Query::HINT_FORCE_PARTIAL_LOAD is an alternative solution, however it has the disadvantage that it disables lazy-loading for **all** queried objects. If partial querying would honor associations this would allow more fine-grained control.
admin added the BugDuplicate labels 2026-01-22 12:49:54 +01:00
admin closed this issue 2026-01-22 12:49:54 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jun 3, 2010):

@doctrinebot commented on GitHub (Jun 3, 2010): - is duplicated by [DDC-1465: Fetching partial objects doesn't work if HINT_FORCE_PARTIAL_LOAD is not explicitly used](http://www.doctrine-project.org/jira/browse/DDC-1465)
Author
Owner

@doctrinebot commented on GitHub (Aug 26, 2010):

Comment created by romanb:

Might need to be pushed back to a 2.0.x / 2.x.x bugfix release. Not clear yet.

@doctrinebot commented on GitHub (Aug 26, 2010): Comment created by romanb: Might need to be pushed back to a 2.0.x / 2.x.x bugfix release. Not clear yet.
Author
Owner

@malukenho commented on GitHub (Jan 5, 2017):

@Ocramius @lcobucci can be closed as duplicated

@malukenho commented on GitHub (Jan 5, 2017): @Ocramius @lcobucci can be closed as duplicated
Author
Owner

@lcobucci commented on GitHub (Jan 5, 2017):

Closing as duplicate of #2094

@lcobucci commented on GitHub (Jan 5, 2017): Closing as `duplicate` of #2094
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#772