| Total Complexity | 4 |
| Total Lines | 40 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class menus extends base_mapper |
||
| 15 | { |
||
| 16 | /** @var string */ |
||
| 17 | protected $entity_class = 'blitze\sitemaker\model\entity\menu'; |
||
| 18 | |||
| 19 | /** @var string */ |
||
| 20 | protected $entity_pkey = 'menu_id'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * {@inheritdoc} |
||
| 24 | */ |
||
| 25 | 22 | public function load(array $condition = array()) |
|
| 26 | { |
||
| 27 | /** @type \blitze\sitemaker\model\entity\menu|null $entity */ |
||
| 28 | 22 | $entity = parent::load($condition); |
|
| 29 | |||
| 30 | if ($entity) |
||
| 31 | 22 | { |
|
| 32 | 16 | $items_mapper = $this->mapper_factory->create('items'); |
|
| 33 | |||
| 34 | /** @type \blitze\sitemaker\model\collections\items $collection */ |
||
| 35 | 16 | $collection = $items_mapper->find(array('%smenu_id', '=', $entity->get_menu_id())); |
|
| 36 | 16 | $entity->set_items($collection); |
|
| 37 | 16 | } |
|
| 38 | |||
| 39 | 22 | return $entity; |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param array|\blitze\sitemaker\model\entity\menu $condition |
||
| 44 | */ |
||
| 45 | 3 | public function delete($condition) |
|
| 54 | 2 | } |
|
| 55 | 3 | } |
|
| 57 |