-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServiceAbstract.php
executable file
·53 lines (43 loc) · 1.09 KB
/
ServiceAbstract.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Created by PhpStorm.
* User: jamie
* Date: 06/10/14
* Time: 20:46
*/
namespace AE\Stdlib;
abstract class ServiceAbstract
{
protected $repository;
public function fetch($id)
{
// var_dump($this->getRepository()->fetch($id));
// die("service abstract");
return $this->getRepository()->fetch($id);
}
public function save($entity)
{
return $this->getRepository()->save($entity);
}
public function delete($id)
{
$this->getRepository()->delete($id);
}
public function fetchCollection($ids, $page = 1, $limit = 10)
{
return $this->getRepository()->fetchCollection($ids, $page, $limit);
}
public function fetchCollectionPaginationFilters($filter, $page = 1, $limit = 10)
{
return $this->getRepository()->fetchCollectionPaginationFilters($filter, $page, $limit);
}
protected function getRepository()
{
return $this->repository;
}
protected function setRepository($repository)
{
$this->repository = $repository;
return $this;
}
}