1 | <?php |
||
31 | class FileSystemRepository implements ReadRepository, WriteRepository, PageRepository |
||
32 | { |
||
33 | /** |
||
34 | * @var FileSystem |
||
35 | */ |
||
36 | protected $fileSystem; |
||
37 | |||
38 | /** |
||
39 | * FileSystemRepository constructor. |
||
40 | * |
||
41 | * @param FileSystem $fileSystem |
||
42 | */ |
||
43 | public function __construct(FileSystem $fileSystem) |
||
47 | |||
48 | /** |
||
49 | * Retrieves an entity by its id. |
||
50 | * |
||
51 | * @param Identity $id |
||
52 | * @param Fields|null $fields |
||
53 | * |
||
54 | * @return mixed |
||
55 | */ |
||
56 | public function find(Identity $id, Fields $fields = null) |
||
60 | |||
61 | /** |
||
62 | * Returns the total amount of elements in the repository given the restrictions provided by the Filter object. |
||
63 | * |
||
64 | * @param Filter|null $filter |
||
65 | * |
||
66 | * @return int |
||
67 | */ |
||
68 | public function count(Filter $filter = null) |
||
78 | |||
79 | /** |
||
80 | * Returns whether an entity with the given id exists. |
||
81 | * |
||
82 | * @param $id |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | public function exists(Identity $id) |
||
90 | |||
91 | /** |
||
92 | * Adds a collections of entities to the storage. |
||
93 | * |
||
94 | * @param array $values |
||
95 | * |
||
96 | * @return mixed |
||
97 | */ |
||
98 | public function addAll(array $values) |
||
105 | |||
106 | /** |
||
107 | * Adds a new entity to the storage. |
||
108 | * |
||
109 | * @param Identity $value |
||
110 | * |
||
111 | * @return mixed |
||
112 | */ |
||
113 | public function add(Identity $value) |
||
117 | |||
118 | /** |
||
119 | * Removes all elements in the repository given the restrictions provided by the Filter object. |
||
120 | * If $filter is null, all the repository data will be deleted. |
||
121 | * |
||
122 | * @param Filter $filter |
||
123 | * |
||
124 | * @return bool |
||
125 | */ |
||
126 | public function removeAll(Filter $filter = null) |
||
141 | |||
142 | /** |
||
143 | * Returns all instances of the type. |
||
144 | * |
||
145 | * @param Filter|null $filter |
||
146 | * @param Sort|null $sort |
||
147 | * @param Fields|null $fields |
||
148 | * |
||
149 | * @return array |
||
150 | */ |
||
151 | public function findBy(Filter $filter = null, Sort $sort = null, Fields $fields = null) |
||
165 | |||
166 | /** |
||
167 | * Removes the entity with the given id. |
||
168 | * |
||
169 | * @param $id |
||
170 | */ |
||
171 | public function remove(Identity $id) |
||
175 | |||
176 | /** |
||
177 | * Returns a Page of entities meeting the paging restriction provided in the Pageable object. |
||
178 | * |
||
179 | * @param Pageable $pageable |
||
180 | * |
||
181 | * @return Page |
||
182 | */ |
||
183 | public function findAll(Pageable $pageable = null) |
||
200 | } |
||
201 |