Пример #1
0
 /**
  * Sets the category constraint to the given constraints array
  *
  * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query Query
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Dto\EventDemand $eventDemand EventDemand
  * @param array $constraints Constraints
  *
  * @return void
  */
 protected function setCategoryConstraint($query, $eventDemand, &$constraints)
 {
     if ($eventDemand->getCategory() != '') {
         $categoryConstraints = [];
         if ($eventDemand->getIncludeSubcategories()) {
             $categoryList = CategoryService::getCategoryListWithChilds($eventDemand->getCategory());
             $categories = GeneralUtility::intExplode(',', $categoryList, true);
         } else {
             $categories = GeneralUtility::intExplode(',', $eventDemand->getCategory(), true);
         }
         foreach ($categories as $category) {
             $categoryConstraints[] = $query->contains('category', $category);
         }
         if (count($categoryConstraints) > 0) {
             $constraints[] = $query->logicalOr($categoryConstraints);
         }
     }
 }
Пример #2
0
 /**
  * Sets the category constraint to the given constraints array
  *
  * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query Query
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Dto\EventDemand $eventDemand EventDemand
  * @param array $constraints Constraints
  *
  * @return void
  */
 protected function setCategoryConstraint($query, $eventDemand, &$constraints)
 {
     if ($eventDemand->getCategory() != '') {
         $categoryConstraints = array();
         $categories = GeneralUtility::intExplode(',', $eventDemand->getCategory(), TRUE);
         foreach ($categories as $category) {
             $categoryConstraints[] = $query->contains('category', $category);
         }
         if (count($categoryConstraints) > 0) {
             $constraints[] = $query->logicalOr($categoryConstraints);
         }
     }
 }
Пример #3
0
 /**
  * @test
  */
 public function getCategoryForStringSetsCategory()
 {
     $this->subject->setCategory('1,2,3,4');
     $this->assertEquals('1,2,3,4', $this->subject->getCategory());
 }