1 | <?php |
||
11 | class PageService |
||
12 | { |
||
13 | /** |
||
14 | * @var PageRepository |
||
15 | */ |
||
16 | private $pageRepository; |
||
17 | |||
18 | /** |
||
19 | * PageService constructor. |
||
20 | * |
||
21 | * @param PageRepository $pageRepository |
||
22 | */ |
||
23 | public function __construct(PageRepository $pageRepository) |
||
27 | |||
28 | /** |
||
29 | * Fetches a page by slug. |
||
30 | * |
||
31 | * @param array $where |
||
32 | * |
||
33 | * @return null|PageEntity |
||
34 | */ |
||
35 | public function fetchOneBy(array $where = []) |
||
36 | { |
||
37 | return $this->pageRepository->fetchOneBy($where); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Creates a page in the database. |
||
42 | * |
||
43 | * @param PageEntity $entity |
||
44 | * |
||
45 | * @return PageEntity |
||
46 | */ |
||
47 | public function create(PageEntity $entity) |
||
51 | |||
52 | /** |
||
53 | * Update a page in the database. |
||
54 | * |
||
55 | * @param PageEntity $entity |
||
56 | * |
||
57 | * @return PageEntity |
||
58 | */ |
||
59 | public function update(PageEntity $entity) |
||
63 | |||
64 | /** |
||
65 | * Removes a page from the database. |
||
66 | * |
||
67 | * @param PageEntity $entity |
||
68 | * |
||
69 | * @return PageEntity |
||
70 | */ |
||
71 | public function remove(PageEntity $entity) |
||
75 | } |
||
76 |