/**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dataHandler = $this->getApplication()->getContainer()->get('data_adapter');
     $this->event = $dataHandler->getEvent($input->getArgument('event_id'));
     if (!$this->event->hasPrizes()) {
         throw new \Exception('This event has no prizes setted.');
     }
     $output->writeln("<info>List of prizes:</info>");
     foreach ($this->event->getPrizes() as $prize) {
         $output->writeln("<comment>{$prize->getSponsorName()} - {$prize->getPrizeTitle()}</comment>");
     }
 }
 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dataHandler = $this->getApplication()->getContainer()->get('data_adapter');
     $this->event = $dataHandler->getEvent($input->getArgument('event_id'));
     $doLoadPrizes = true;
     if ($this->event->hasPrizes()) {
         $doLoadPrizes = $this->getHelper('dialog')->askConfirmation($output, 'The list of prizes for this event ID already exists, do you want to override? (no) ', false);
     }
     if ($doLoadPrizes) {
         $this->event->clearPrizes();
         $this->loadPrizes($input->getArgument('file'));
         $dataHandler->saveEvent($this->event);
         $output->writeln("<info>Loaded</info> <comment>{$this->event->getNumberOfPrizes()}</comment> <info>prizes.</info>");
     }
 }
 public function testPopPrize()
 {
     $event = new Event('test');
     $event->setPrizes(array('Prize'));
     $this->assertEquals(1, $event->getNumberOfPrizes());
     $this->assertTrue($event->hasPrizes());
     $this->assertEquals('Prize', $event->popPrize(0));
 }