How to ignore the page id (pid) in repository database query (Extbase ORM)

Ignore the PID settings by setting setRespectStoragePage to false.

use TYPO3\CMS\Extbase\Persistence\QueryInterface;

class MyRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{

    /**
     * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
     */
    public function yourOwnFunction()
    {

        /** @var $querySettings \TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings */
        $querySettings = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\Typo3QuerySettings');
        $querySettings->setRespectStoragePage(false);
        $this->setDefaultQuerySettings($querySettings);

        $query = $this->createQuery();
        return $query->execute();
    }

}

Be the first to comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.