/** * Find items by filter for management * * @param \Planetflow3\Domain\Dto\ItemFilter $filter * @return \TYPO3\FLOW3\Persistence\QueryResultInterface */ public function findByFilter(\Planetflow3\Domain\Dto\ItemFilter $filter = NULL) { $query = $this->createQuery(); $constraints = array(); if ($filter === NULL) { $filter = new \Planetflow3\Domain\Dto\ItemFilter(); } if ((string) $filter->getLanguage() !== '') { $constraints[] = $query->equals('language', $filter->getLanguage()); } if ($filter->getDisabled() !== NULL) { $constraints[] = $query->equals('disabled', $filter->getDisabled()); } if ($filter->getChannel() !== NULL) { $constraints[] = $query->equals('channel', $filter->getChannel()); } if ($filter->getCategory() !== NULL) { $constraints[] = $query->contains('categories', $filter->getCategory()); } if (count($constraints) > 0) { $query->matching($query->logicalAnd($constraints)); } return $query->execute(); }
/** * Feed action * * Render an aggregated feed for a given language. * * @param string $language Filter by language, NULL for all languages */ public function feedAction($language = NULL) { $filter = new \Planetflow3\Domain\Dto\ItemFilter(); $filter->setLanguage($language); $filter->setDisabled(FALSE); $result = $this->itemRepository->findByFilter($filter); $query = $result->getQuery(); $query->setLimit(20); $items = $query->execute(); $this->view->assign('language', $language); $this->view->assign('items', $items); $this->response->setHeader('Content-Type', 'application/rss+xml; charset=UTF-8'); // TODO Send correct cache control including last modified }