/**
  * Returns all categories depending on the settings in the demand object
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Dto\ForeignRecordDemand $demand ForeignRecordDemand
  *
  * @return array|\TYPO3\CMS\Extbase\Persistence\QueryResultInterface
  */
 public function findDemanded($demand)
 {
     $constraints = [];
     $query = $this->createQuery();
     if ($demand->getRestrictForeignRecordsToStoragePage()) {
         $pidList = GeneralUtility::intExplode(',', $demand->getStoragePage(), true);
         $constraints[] = $query->in('pid', $pidList);
     }
     if (count($constraints) > 0) {
         $query->matching($query->logicalAnd($constraints));
     }
     return $query->execute();
 }
 /**
  * @test
  */
 public function setRestrictForeignRecordsToStoragePageSetsValueForBoolean()
 {
     $this->subject->setRestrictForeignRecordsToStoragePage(true);
     $this->assertTrue($this->subject->getRestrictForeignRecordsToStoragePage());
 }