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

MapController   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 39
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A listAction() 0 15 2
A createAction() 0 4 1
A editAction() 0 4 1
A deleteAction() 0 4 1
A redirectTo() 0 5 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