mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Fetch all but some specified columns in partial load #6426
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Phobetor on GitHub (Mar 16, 2020).
Feature Request
New syntax construct to allow specification of columns that should be excluded from the full result set in a partial load.
Summary
Partial loads are very neat to avoid loading vast amounts of data when only some columns are required but you loose flexibility when doing so. Every new column which is added to an entity and then used at some place in the application which uses a partial load also requires to add it to the partial definition. This can lead to very lengthy query builder constructions.
I have some cases (admin overviews mostly) where I only want to exclude a very small amount of columns e. g. because they are BLOBs but I would like to keep all the other fields in the result.
To solve this I suggest to have some new syntax that allows to exclude columns from the partial load keeping all the other columns (not listed in the definition explicitly) in the result.
Example
Lets assume there is a table
twith 10 columns (a,b,c,d,e,f,g,h,i,j) and I want to fetch all columns butiandj.Currently the query builder would look like this:
Lets assume that
partial t.{-…}is the syntax for the new column exclusion. Then the new query builder would look like this:Just table
twithout columniandj.@aelamel commented on GitHub (Jul 10, 2020):
It would be great if we have this feature in doctrine.