Issue Bug Closed

#102635\TYPO3\CMS\Extbase\Persistence\Repository->findByUid does not respect defaultQuerySettings

This Mächler 12/09/23, 07:29 updated 11/22/24, 15:45

Description

Settings by

$this->setDefaultQuerySettings( )

in

\TYPO3\CMS\Extbase\Persistence\Repository

will not be respected when calling

\TYPO3\CMS\Extbase\Persistence\Repository->findByUid()

For example with these settings

$this->defaultQuerySettings = $this->createQuery()->getQuerySettings()
    ->setEnableFieldsToBeIgnored(['disabled'])
    ->setIgnoreEnableFields( true );
$this->setDefaultQuerySettings( $this->defaultQuerySettings );

native findByUid will will hidden / disabled records. A custom findByUid fixes this:

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

Reviews 0

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