Add QueryBuilder::setFetchMode #6505

Closed
opened 2026-01-22 15:34:13 +01:00 by admin · 1 comment
Owner

Originally created by @kirya-dev on GitHub (Jul 23, 2020).

Feature Request

Q A
New Feature yes
RFC yes
BC Break no

Summary

Im would like to add new configure query builder method.
Im has following code:

    protected function configureQueryBuilder(QueryBuilder $qb, string $alias): void
    {
        $qb->getQuery()->setFetchMode(User::class, 'user', ClassMetadataInfo::FETCH_EAGER);
    }

Me need set fetch mode, but is impossible because getQuery creates new Query. There useless setFetchMode on new Query

getQuery must set fetchMode also lifetime, cacheMode, cacheable etc..
2a98a98cd3/lib/Doctrine/ORM/QueryBuilder.php (L344-L369)

Originally created by @kirya-dev on GitHub (Jul 23, 2020). ### Feature Request | Q | A |------------ | ------ | New Feature | yes | RFC | yes | BC Break | no #### Summary Im would like to add new configure query builder method. Im has following code: ``` PHP protected function configureQueryBuilder(QueryBuilder $qb, string $alias): void { $qb->getQuery()->setFetchMode(User::class, 'user', ClassMetadataInfo::FETCH_EAGER); } ``` Me need set fetch mode, but is impossible because getQuery creates new Query. There useless `setFetchMode` on new Query `getQuery` must set `fetchMode` also `lifetime`, `cacheMode`, `cacheable` etc.. https://github.com/doctrine/orm/blob/2a98a98cd36e5eb54ad5ff8ca26fc3a30d5a82ff/lib/Doctrine/ORM/QueryBuilder.php#L344-L369
admin closed this issue 2026-01-22 15:34:14 +01:00
Author
Owner

@beberlei commented on GitHub (Dec 6, 2020):

This would be convenient, but also annoying to maintain and update for each new thing, i believe you should do this on your end.

@beberlei commented on GitHub (Dec 6, 2020): This would be convenient, but also annoying to maintain and update for each new thing, i believe you should do this on your end.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6505