| @@ 51-66 (lines=16) @@ | ||
| 48 | return array("match" => $match); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function createAction(Player $me) |
|
| 52 | { |
|
| 53 | return $this->create($me, function (Match $match) use ($me) { |
|
| 54 | if ($me->canEdit($match) |
|
| 55 | && $match->isOfficial() |
|
| 56 | && (!$match->getTeamA()->isLastMatch($match) |
|
| 57 | || !$match->getTeamB()->isLastMatch($match)) |
|
| 58 | ) { |
|
| 59 | $url = Service::getGenerator()->generate('match_recalculate', array( |
|
| 60 | 'match' => $match->getId(), |
|
| 61 | )); |
|
| 62 | ||
| 63 | return new RedirectResponse($url); |
|
| 64 | } |
|
| 65 | }); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function deleteAction(Player $me, Match $match) |
|
| 69 | { |
|
| @@ 70-81 (lines=12) @@ | ||
| 67 | ||
| 68 | public function deleteAction(Player $me, Match $match) |
|
| 69 | { |
|
| 70 | return $this->delete($match, $me, function () use ($match, $me) { |
|
| 71 | if ($match->getTeamA()->isLastMatch($match) |
|
| 72 | && $match->getTeamB()->isLastMatch($match)) { |
|
| 73 | $match->resetELOs(); |
|
| 74 | } elseif ($me->canEdit($match)) { |
|
| 75 | $url = Service::getGenerator()->generate('match_recalculate', array( |
|
| 76 | 'match' => $match->getId(), |
|
| 77 | )); |
|
| 78 | ||
| 79 | return new RedirectResponse($url); |
|
| 80 | } |
|
| 81 | }); |
|
| 82 | } |
|
| 83 | ||
| 84 | public function editAction(Player $me, Match $match) |
|