Completed
Push — master ( cd6f74...3785c8 )
by Konstantinos
03:56
created

MapController::redirectTo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4286
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
class MapController extends CRUDController
4
{
5
    public function listAction(Map $map = null)
6
    {
7
        if ($map === null) {
8
            $qb = $this->getQueryBuilder();
9
10
            $maps = $qb->sortBy('name')
11
                ->getModels();
12
        } else {
13
            $maps = array($map);
14
        }
15
16
        return array(
17
            "maps" => $maps
18
        );
19
    }
20
21
    public function createAction(Player $me)
22
    {
23
        return $this->create($me);
24
    }
25
26
    public function editAction(Player $me, Map $map)
27
    {
28
        return $this->edit($map, $me, "map");
29
    }
30
31
    public function deleteAction(Player $me, Map $map)
32
    {
33
        return $this->delete($map, $me);
34
    }
35
36
    protected function redirectTo($model)
37
    {
38
        // Redirect to the map list after creating/editing a map
39
        return $this->redirectToList($model);
40
    }
41
}
42