/** * Create sample data * * @return void */ public function sampleDataCommand() { $this->itemRepository->removeAll(); $this->channelRepository->removeAll(); $this->categoryRepository->removeAll(); $flow3Category = new \Planetflow3\Domain\Model\Category('FLOW3'); $this->categoryRepository->add($flow3Category); $phpCategory = new \Planetflow3\Domain\Model\Category('PHP'); $this->categoryRepository->add($phpCategory); $phoenixCategory = new \Planetflow3\Domain\Model\Category('Phoenix'); $this->categoryRepository->add($phoenixCategory); $channels = array(); $channel = new \Planetflow3\Domain\Model\Channel(); $channel->setName('news.typo3.org: FLOW3'); $channel->setUrl('http://news.typo3.org/news/teams/flow3/'); $channel->setFeedUrl('http://news.typo3.org/news/teams/flow3/rss.xml'); $channel->setDefaultCategory($flow3Category); $this->channelRepository->add($channel); $channels[] = $channel; $channel = new \Planetflow3\Domain\Model\Channel(); $channel->setName('Karsten Dambekalns - Code & Content'); $channel->setUrl('http://blog.k-fish.de'); $channel->setFeedUrl('http://blog.k-fish.de/feeds/posts/default'); $channel->setFetchedCategories(array('PHP', 'FLOW3')); $this->channelRepository->add($channel); $channels[] = $channel; $channel = new \Planetflow3\Domain\Model\Channel(); $channel->setName('networkteam Blog - FLOW3'); $channel->setUrl('http://www.networkteam.com/blog.html'); $channel->setFeedUrl('http://www.networkteam.com/rss.xml'); $channel->setFilter('FLOW3'); $channel->setDefaultCategory($flow3Category); $this->channelRepository->add($channel); $channels[] = $channel; $channel = new \Planetflow3\Domain\Model\Channel(); $channel->setName('Robert Lemke - Fluent Code Artisan'); $channel->setUrl('http://robertlemke.de/blog/'); $channel->setFeedUrl('http://robertlemke.de/blog/feeds/posts.rss.xml'); $channel->setFilter('FLOW3,PHP'); $channel->setDefaultCategory($flow3Category); $this->channelRepository->add($channel); $channels[] = $channel; $channel = new \Planetflow3\Domain\Model\Channel(); $channel->setName('t3blog.de'); $channel->setUrl('http://t3blog.de'); $channel->setFeedUrl('http://t3blog.de/feed/'); $channel->setFilter('FLOW3'); $channel->setDefaultCategory($flow3Category); $this->channelRepository->add($channel); $channels[] = $channel; $channel = new \Planetflow3\Domain\Model\Channel(); $channel->setName('layh.com'); $channel->setUrl('http://www.layh.com'); $channel->setFeedUrl('http://www.layh.com/wordpress/feed/'); $channel->setFetchedCategories(array('FLOW3')); $this->channelRepository->add($channel); $channels[] = $channel; $this->outputLine('Created default categories and channels'); }
/** * @return array Categories indexed by name */ protected function getAvailableCategories() { if ($this->availableCategories === NULL) { $availableCategories = $this->categoryRepository->findAll(); $availableCategoriesByName = array(); foreach ($availableCategories as $availableCategory) { $availableCategoriesByName[$availableCategory->getName()] = $availableCategory; } $this->availableCategories = $availableCategoriesByName; } return $this->availableCategories; }
/** * Delete action * * @param \Planetflow3\Domain\Model\Category $category * @FLOW3\IgnoreValidation("$category") */ public function deleteAction(\Planetflow3\Domain\Model\Category $category) { $this->categoryRepository->remove($category); $this->addFlashMessage('Category removed.', 'Success', \TYPO3\FLOW3\Error\Message::SEVERITY_NOTICE); $this->redirect('index'); }
/** * Edit action * * @param \Planetflow3\Domain\Model\Item $item * @FLOW3\IgnoreValidation("$item") */ public function editAction(\Planetflow3\Domain\Model\Item $item) { $categories = $this->categoryRepository->findAll(); $this->view->assign('item', $item); $this->view->assign('categories', $categories); }