Beispiel #1
0
 public function testGetArrayCopy()
 {
     $this->tournament->setId(1);
     $this->tournament->setName('Foo');
     $this->tournament->setGamesPerMatch(2);
     $this->tournament->setTeamType(1);
     $this->tournament->setStart(new \DateTime('1994-04-05'));
     $this->assertEquals(array('id' => 1, 'name' => 'Foo', 'team-type' => 1, 'start-date' => new \DateTime('1994-04-05'), 'games-per-match' => 2, 'max-score' => 10), $this->tournament->getArrayCopy());
 }
 /**
  * @return array|\Zend\Http\Response
  */
 public function addLeagueAction()
 {
     $form = new LeagueForm();
     $tournament = new League();
     $tournament->setStart(new \DateTime());
     $form->bind($tournament);
     $form->setInputFilter(new \Application\Form\InputFilter\League($this->tournamentRepository));
     if ($this->request->isPost()) {
         $form->setData($this->request->getPost());
         if ($form->isValid()) {
             $this->tournamentRepository->persist($tournament);
             return $this->redirect()->toRoute('tournaments');
         }
     }
     return array('form' => $form);
 }