/** * @test */ public function limitToOrganizersForNoProvidedOrganizerFindsEventWithOrganizer() { $eventUid = $this->testingFramework->createRecord('tx_seminars_seminars'); $organizerUid = $this->testingFramework->createRecord('tx_seminars_organizers'); $this->testingFramework->createRelationAndUpdateCounter('tx_seminars_seminars', $eventUid, $organizerUid, 'organizers'); $this->fixture->limitToOrganizers(''); $bag = $this->fixture->build(); self::assertSame(1, $bag->count()); }
/** * Limits the given seminarbagbuilder for additional parameters needed to * build the list view. * * @param tx_seminars_BagBuilder_Event $builder * the seminarbagbuilder to limit for additional parameters * * @return void */ protected function limitForAdditionalParameters(tx_seminars_BagBuilder_Event $builder) { // Adds the query parameter that result from the user selection in the // selector widget (including the search form). if (is_array($this->piVars['language'])) { $builder->limitToLanguages(tx_seminars_FrontEnd_SelectorWidget::removeDummyOptionFromFormData($this->piVars['language'])); } // TODO: This needs to be changed when bug 3410 gets fixed. // @see https://bugs.oliverklee.com/show_bug.cgi?id=3410 if (is_array($this->piVars['place'])) { $builder->limitToPlaces(tx_seminars_FrontEnd_SelectorWidget::removeDummyOptionFromFormData($this->piVars['place'])); } else { // TODO: This needs to be changed as soon as we are using the new // TypoScript configuration class from tx_oelib which offers a // getAsIntegerArray() method. $builder->limitToPlaces(t3lib_div::trimExplode(',', $this->getConfValueString('limitListViewToPlaces', 's_listView'), TRUE)); } if (is_array($this->piVars['city'])) { $builder->limitToCities(tx_seminars_FrontEnd_SelectorWidget::removeDummyOptionFromFormData($this->piVars['city'])); } if (is_array($this->piVars['country'])) { $builder->limitToCountries(tx_seminars_FrontEnd_SelectorWidget::removeDummyOptionFromFormData($this->piVars['country'])); } if (is_array($this->piVars['organizer'])) { $builder->limitToOrganizers(implode(',', tx_seminars_FrontEnd_SelectorWidget::removeDummyOptionFromFormData($this->piVars['organizer']))); } else { $builder->limitToOrganizers($this->getConfValueString('limitListViewToOrganizers', 's_listView')); } if (isset($this->piVars['sword']) && !empty($this->piVars['sword'])) { $builder->limitToFullTextSearch($this->piVars['sword']); } if ($this->getConfValueBoolean('hideCanceledEvents', 's_template_special')) { $builder->ignoreCanceledEvents(); } if (isset($this->piVars['event_type']) && is_array($this->piVars['event_type'])) { $builder->limitToEventTypes(tx_seminars_FrontEnd_SelectorWidget::removeDummyOptionFromFormData($this->piVars['event_type'])); } else { // TODO: This needs to be changed as soon as we are using the new // TypoScript configuration class from tx_oelib which offers a // getAsIntegerArray() method. $builder->limitToEventTypes(t3lib_div::trimExplode(',', $this->getConfValueString('limitListViewToEventTypes', 's_listView'), TRUE)); } $categoryUid = isset($this->piVars['category']) ? (int) $this->piVars['category'] : 0; $categoryUids = isset($this->piVars['categories']) ? (array) $this->piVars['categories'] : array(); array_walk($categoryUids, 'intval'); if ($categoryUid > 0) { $categories = (string) $categoryUid; } elseif (!empty($categoryUids)) { $categories = implode(',', $categoryUids); } else { $categories = $this->getConfValueString('limitListViewToCategories', 's_listView'); } $builder->limitToCategories($categories); if ($this->piVars['age'] > 0) { $builder->limitToAge($this->piVars['age']); } if ($this->piVars['price_from'] > 0) { $builder->limitToMinimumPrice($this->piVars['price_from']); } if ($this->piVars['price_to'] > 0) { $builder->limitToMaximumPrice($this->piVars['price_to']); } $this->filterByDate($builder); }