Issue Bug Closed

#95053findByUid not respecting default query settings of repository

Eric Harrer 08/31/21, 13:38 updated 03/04/26, 10:41

Description

In my repository I use:

public function initializeObject()
{
    $querySettings = new Typo3QuerySettings();
    $querySettings->setRespectStoragePage(false);
    $querySettings->setRespectSysLanguage(false);
    $querySettings->setIgnoreEnableFields(true);
    $this->setDefaultQuerySettings($querySettings);
}

Although setIgnoreEnableFields was set to true in the default query settings I am not able to find hidden elements with findByUid in my controller.

As a workaround, I’ve overridden findByUid in the repository as follows:

public function findByUid($uid)
{
    $query = $this->createQuery();
    return $query->matching($query->equals('uid', $uid))->execute()->getFirst();
}

This seems to be related to:
https://forge.typo3.org/projects/typo3cms-core/repository/1749/revisions/84c4ff2f2ec1ce98a9b170a6869b57cb4bb32a0c

I am not sure if this is a bug. Possibly this is just a missing piece in the documentation.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 3

  1. Eric Harrer commented and changed Is Regression 0 <span data-processor="relativetime" data-value="2026-03-04T10:34:48+00:00" > 03/04/26, 10:34 </span>

    Re-evaluation

    I re-checked the behavior on main and reproduced it today.

    Result

    This is expected Extbase behavior, not a current Core regression.

    Reproduction

    In a repository configured with default query settings such as:
    • setRespectStoragePage(false)
    • setRespectSysLanguage(false)
    • setIgnoreEnableFields(true)

    calling findByUid(20) (where record uid=20 is hidden, i.e. hidden=1) returns null, while an explicit repository query can return that record.

    Why this happens

    findByUid() does not use the repository query path:
    @Repository::findByUid() -> findByIdentifier() -> PersistenceManager::getObjectByIdentifier() -> Generic\\Backend::getObjectByIdentifier()@.

    That identifier lookup path creates and uses its own query settings. Repository-level defaultQuerySettings (including ignoreEnableFields) are not applied there.

    Historical context

    Conclusion

    No Core bug here.
    For use cases that must honor ignoreEnableFields (or other repository default query settings), use an explicit query method instead of findByUid().

    I suggest closing this as No bug / expected behavior.