| 1 | <?php |
||
| 11 | class DataProvider implements DataProviderInterface |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var RepositoryInterface |
||
| 15 | */ |
||
| 16 | protected $repository; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * DataProvider constructor. |
||
| 20 | * |
||
| 21 | * @param RepositoryInterface $repository |
||
| 22 | */ |
||
| 23 | 10 | public function __construct( |
|
| 28 | |||
| 29 | /** |
||
| 30 | * Find entities by criteria. |
||
| 31 | * |
||
| 32 | * @param array $criteria |
||
| 33 | * @param array $orderBy |
||
| 34 | * @param int|null $limit |
||
| 35 | * @param int|null $offset |
||
| 36 | * @return Collection|array |
||
| 37 | */ |
||
| 38 | 1 | public function findBy(array $criteria = [], $orderBy = [], $limit = null, $offset = null) |
|
| 44 | |||
| 45 | /** |
||
| 46 | * Find an entity by its unique id. |
||
| 47 | * |
||
| 48 | * @param $id |
||
| 49 | * @return object |
||
| 50 | */ |
||
| 51 | 1 | public function find($id) |
|
| 57 | |||
| 58 | /** |
||
| 59 | * Save an entity. |
||
| 60 | * |
||
| 61 | * @param $entity |
||
| 62 | */ |
||
| 63 | 1 | public function save($entity) |
|
| 69 | |||
| 70 | /** |
||
| 71 | * Remove an entity. |
||
| 72 | * |
||
| 73 | * @param $entity |
||
| 74 | */ |
||
| 75 | 1 | public function remove($entity) |
|
| 81 | |||
| 82 | /** |
||
| 83 | * Create a new entity. |
||
| 84 | * |
||
| 85 | * @return object |
||
| 86 | */ |
||
| 87 | 1 | public function create() |
|
| 93 | } |
||
| 94 |