/** * 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; }