Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 2.0023 |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 1 | public function execute() |
|
19 | { |
||
20 | 1 | $menu_id = $this->request->variable('menu_id', 0); |
|
21 | |||
22 | 1 | $menu_mapper = $this->mapper_factory->create('menus', 'menus'); |
|
23 | 1 | $items_mapper = $this->mapper_factory->create('menus', 'items'); |
|
24 | |||
25 | 1 | if ($menu_mapper->load(array('menu_id', '=', $menu_id)) === null) |
|
26 | 1 | { |
|
27 | throw new \blitze\sitemaker\exception\out_of_bounds('MENU_NOT_FOUND'); |
||
28 | } |
||
29 | |||
30 | 1 | $entity = $items_mapper->create_entity(array( |
|
31 | 1 | 'menu_id' => $menu_id, |
|
32 | 1 | )); |
|
33 | |||
34 | 1 | $entity = $items_mapper->save($entity); |
|
35 | |||
36 | 1 | return $entity->to_array(); |
|
37 | } |
||
38 | } |
||
39 |