1 | <?php |
||
15 | class items extends base_mapper |
||
16 | { |
||
17 | /** @var \phpbb\config\config */ |
||
18 | protected $config; |
||
19 | |||
20 | /** @var \blitze\sitemaker\services\menus\nestedset */ |
||
21 | protected $tree; |
||
22 | |||
23 | /** @var string */ |
||
24 | protected $entity_class = 'blitze\sitemaker\model\entity\item'; |
||
25 | |||
26 | /** @var string */ |
||
27 | protected $entity_pkey = 'item_id'; |
||
28 | |||
29 | /** |
||
30 | * Constructor |
||
31 | * |
||
32 | * @param \phpbb\db\driver\driver_interface $db Database object |
||
33 | * @param \blitze\sitemaker\model\base_collection $collection Entity collection |
||
34 | * @param \blitze\sitemaker\model\mapper_factory $mapper_factory Mapper factory object |
||
35 | * @param string $entity_table Menu Items table |
||
36 | * @param \phpbb\config\config $config Config object |
||
37 | */ |
||
38 | 54 | public function __construct(\phpbb\db\driver\driver_interface $db, \blitze\sitemaker\model\base_collection $collection, \blitze\sitemaker\model\mapper_factory $mapper_factory, $entity_table, \phpbb\config\config $config) |
|
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | 11 | public function load(array $condition = array()) |
|
66 | |||
67 | /** |
||
68 | * {@inheritdoc} |
||
69 | */ |
||
70 | 38 | public function find(array $condition = array()) |
|
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | 6 | public function save(\blitze\sitemaker\model\entity_interface $entity) |
|
107 | |||
108 | /** |
||
109 | * Add multiple items via string depicting hierarchical structure |
||
110 | * |
||
111 | * @param int $menu_id |
||
112 | * @param int $parent_id |
||
113 | * @param $string |
||
114 | * @return \blitze\sitemaker\model\base_collection |
||
115 | */ |
||
116 | 7 | public function add_items($menu_id, $parent_id, $string) |
|
131 | |||
132 | /** |
||
133 | * Update entire tree saving parent-child relationships in a single go |
||
134 | * |
||
135 | * @param int $menu_id |
||
136 | * @param array $items |
||
137 | * @return array |
||
138 | */ |
||
139 | 3 | public function update_items($menu_id, array $items) |
|
144 | |||
145 | /** |
||
146 | * {@inheritdoc} |
||
147 | */ |
||
148 | 44 | public function create_entity(array $row) |
|
152 | |||
153 | /** |
||
154 | * @param array $items |
||
155 | * @return array |
||
156 | */ |
||
157 | 6 | protected function prep_items_for_storage(array $items) |
|
170 | |||
171 | /** |
||
172 | * @param int $menu_id |
||
173 | * @return string |
||
174 | */ |
||
175 | 15 | protected function get_sql_where($menu_id) |
|
179 | } |
||
180 |