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