public function testAddingGames() { $game1 = new Game(); $game2 = new Game(); $this->match->setGames(array($game1, $game2)); $games = $this->match->getGames(); $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $games); $this->assertSame($game1, $games[0]); $this->assertSame($game2, $games[1]); }
/** * Hydrate $object with the provided $data. * * @param array $data * @param \Application\Model\Entity\Match $match * * @return \Application\Model\Entity\Match */ public function hydrate(array $data, $match) { $match->setGames($data['games']); if ($match instanceof DoubleMatch) { $match->setTeamOne($this->repository->find($data['teamOneAttack']), $this->repository->find($data['teamOneDefence'])); $match->setTeamTwo($this->repository->find($data['teamTwoAttack']), $this->repository->find($data['teamTwoDefence'])); } return $match; }