protected function initializeListAction()
 {
     if (!$this->request->hasArgument(self::ARGUMENT_DEMAND)) {
         /** @var \Frappant\FrpExample\Domain\Model\Dto\ItemDemand */
         $itemDemand = ItemDemand::factory($this->setup->get('list.demand', array()));
         $this->request->setArgument(self::ARGUMENT_DEMAND, $itemDemand);
     }
 }
 /**
  * [findDemanded description]
  *
  * @param \Frappant\FrpExample\Domain\Model\Dto\ItemDemand $itemDemand [description]
  * @return [type]                                                       [description]
  */
 public function findDemanded(\Frappant\FrpExample\Domain\Model\Dto\ItemDemand $itemDemand)
 {
     /** @var TYPO3\CMS\Extbase\Persistence\Generic\Query $query */
     $query = $this->createQuery();
     // $querySettings = $query->getQuerySettings();
     $constraints = array();
     if ($itemDemand->getTitle()) {
         $constraints[] = $this->createTitleConstraint($query, $itemDemand->getTitle());
     }
     // if ($itemDemand->getGroup()){
     // 	$constraints[] = $query->contains('groups', $itemDemand->getGroup());
     // }
     if (!empty($constraints)) {
         $query->matching($query->logicalAnd($constraints));
     }
     if ($itemDemand->getLimit()) {
         $query->setLimit($itemDemand->getLimit());
     }
     return $query->execute();
 }
 /**
  * @test
  */
 public function setGroupForStringSetsGroup()
 {
     $this->subject->setGroup(123);
     $this->assertAttributeEquals(123, 'group', $this->subject);
 }
 /**
  * @test
  * @dataProvider searchByTitleDataProvider
  */
 public function searchByTitle($title, $matches)
 {
     $itemDemand = new ItemDemand();
     $itemDemand->setTitle($title);
     $items = $this->itemRepository->findDemanded($itemDemand);
     $this->assertCount($matches, $items);
     $this->assertContainsOnlyInstancesOf(Item::class, $items);
 }