/**
  * Create query
  *
  * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
  */
 public function createQuery()
 {
     $query = parent::createQuery();
     $query->getQuerySettings()->setRespectStoragePage(false);
     return $query;
 }
 /**
  * Returns all objects of this repository.
  *
  * @param int $topCategoryId
  *
  * @return \TYPO3\CMS\Extbase\Persistence\QueryResultInterface|array
  */
 public function findAll($topCategoryId = 0)
 {
     if (!$topCategoryId) {
         return parent::findAll();
     } else {
         $query = $this->createQuery();
         $constraintsOr = array();
         $constraintsOr[] = $query->contains('categories', $topCategoryId);
         $constraintsOr[] = $query->equals('categories.parent', $topCategoryId);
         $query->matching($query->logicalOr($constraintsOr));
         return $query->execute();
     }
 }