1 | <?php |
||
19 | class LaravelQuery implements IQueryProvider |
||
20 | { |
||
21 | protected $expression; |
||
22 | protected $auth; |
||
23 | public $queryProviderClassName; |
||
24 | |||
25 | 2 | public function __construct(AuthInterface $auth = null) |
|
32 | |||
33 | /** |
||
34 | * Indicates if the QueryProvider can handle ordered paging, this means respecting order, skip, and top parameters |
||
35 | * If the query provider can not handle ordered paging, it must return the entire result set and POData will |
||
36 | * perform the ordering and paging |
||
37 | * |
||
38 | * @return Boolean True if the query provider can handle ordered paging, false if POData should perform the paging |
||
39 | */ |
||
40 | public function handlesOrderedPaging() |
||
44 | |||
45 | /** |
||
46 | * Gets the expression provider used by to compile OData expressions into expression used by this query provider. |
||
47 | * |
||
48 | * @return \POData\Providers\Expression\IExpressionProvider |
||
49 | */ |
||
50 | public function getExpressionProvider() |
||
54 | |||
55 | /** |
||
56 | * Gets collection of entities belongs to an entity set |
||
57 | * IE: http://host/EntitySet |
||
58 | * http://host/EntitySet?$skip=10&$top=5&filter=Prop gt Value |
||
59 | * |
||
60 | * @param QueryType $queryType indicates if this is a query for a count, entities, or entities with a count |
||
61 | * @param ResourceSet $resourceSet The entity set containing the entities to fetch |
||
62 | * @param FilterInfo $filterInfo represents the $filter parameter of the OData query. NULL if no $filter specified |
||
63 | * @param mixed $orderBy sorted order if we want to get the data in some specific order |
||
64 | * @param int $top number of records which need to be skip |
||
65 | * @param String $skipToken value indicating what records to skip |
||
66 | * |
||
67 | * @return QueryResult |
||
68 | */ |
||
69 | 3 | public function getResourceSet( |
|
130 | /** |
||
131 | * Gets an entity instance from an entity set identified by a key |
||
132 | * IE: http://host/EntitySet(1L) |
||
133 | * http://host/EntitySet(KeyA=2L,KeyB='someValue') |
||
134 | * |
||
135 | * @param ResourceSet $resourceSet The entity set containing the entity to fetch |
||
136 | * @param KeyDescriptor $keyDescriptor The key identifying the entity to fetch |
||
137 | * |
||
138 | * @return object|null Returns entity instance if found else null |
||
139 | */ |
||
140 | public function getResourceFromResourceSet( |
||
146 | |||
147 | /** |
||
148 | * Common method for getResourceFromRelatedResourceSet() and getResourceFromResourceSet() |
||
149 | * @param ResourceSet|null $resourceSet |
||
150 | * @param null|KeyDescriptor $keyDescriptor |
||
151 | */ |
||
152 | protected function getResource( |
||
179 | |||
180 | /** |
||
181 | * Get related resource set for a resource |
||
182 | * IE: http://host/EntitySet(1L)/NavigationPropertyToCollection |
||
183 | * http://host/EntitySet?$expand=NavigationPropertyToCollection |
||
184 | * |
||
185 | * @param QueryType $queryType indicates if this is a query for a count, entities, or entities with a count |
||
186 | * @param ResourceSet $sourceResourceSet The entity set containing the source entity |
||
187 | * @param object $sourceEntityInstance The source entity instance. |
||
188 | * @param ResourceSet $targetResourceSet The resource set of containing the target of the navigation property |
||
189 | * @param ResourceProperty $targetProperty The navigation property to retrieve |
||
190 | * @param FilterInfo $filter represents the $filter parameter of the OData query. NULL if no $filter specified |
||
191 | * @param mixed $orderBy sorted order if we want to get the data in some specific order |
||
192 | * @param int $top number of records which need to be skip |
||
193 | * @param String $skip value indicating what records to skip |
||
194 | * |
||
195 | * @return QueryResult |
||
196 | * |
||
197 | */ |
||
198 | 3 | public function getRelatedResourceSet( |
|
223 | |||
224 | /** |
||
225 | * Gets a related entity instance from an entity set identified by a key |
||
226 | * IE: http://host/EntitySet(1L)/NavigationPropertyToCollection(33) |
||
227 | * |
||
228 | * @param ResourceSet $sourceResourceSet The entity set containing the source entity |
||
229 | * @param object $sourceEntityInstance The source entity instance. |
||
230 | * @param ResourceSet $targetResourceSet The entity set containing the entity to fetch |
||
231 | * @param ResourceProperty $targetProperty The metadata of the target property. |
||
232 | * @param KeyDescriptor $keyDescriptor The key identifying the entity to fetch |
||
233 | * |
||
234 | * @return object|null Returns entity instance if found else null |
||
235 | */ |
||
236 | public function getResourceFromRelatedResourceSet( |
||
246 | |||
247 | /** |
||
248 | * Get related resource for a resource |
||
249 | * IE: http://host/EntitySet(1L)/NavigationPropertyToSingleEntity |
||
250 | * http://host/EntitySet?$expand=NavigationPropertyToSingleEntity |
||
251 | * |
||
252 | * @param ResourceSet $sourceResourceSet The entity set containing the source entity |
||
253 | * @param object $sourceEntityInstance The source entity instance. |
||
254 | * @param ResourceSet $targetResourceSet The entity set containing the entity pointed to by the navigation property |
||
255 | * @param ResourceProperty $targetProperty The navigation property to fetch |
||
256 | * |
||
257 | * @return object|null The related resource if found else null |
||
258 | */ |
||
259 | public function getRelatedResourceReference( |
||
268 | |||
269 | /** |
||
270 | * @param ResourceSet $resourceSet |
||
271 | * @return mixed |
||
272 | */ |
||
273 | protected function getSourceEntityInstance(ResourceSet $resourceSet) |
||
279 | |||
280 | /** |
||
281 | * Updates a resource |
||
282 | * |
||
283 | * @param ResourceSet $sourceResourceSet The entity set containing the source entity |
||
284 | * @param object $sourceEntityInstance The source entity instance |
||
285 | * @param KeyDescriptor $keyDescriptor The key identifying the entity to fetch |
||
286 | * @param object $data The New data for the entity instance. |
||
287 | * @param bool $shouldUpdate Should undefined values be updated or reset to default |
||
288 | * |
||
289 | * @return object|null The new resource value if it is assignable or throw exception for null. |
||
290 | */ |
||
291 | public function updateResource( |
||
300 | /** |
||
301 | * Delete resource from a resource set. |
||
302 | * @param ResourceSet|null $resourceSet |
||
303 | * @param object $sourceEntityInstance |
||
304 | * |
||
305 | * return bool true if resources sucessfully deteled, otherwise false. |
||
306 | */ |
||
307 | public function deleteResource( |
||
313 | /** |
||
314 | * @param ResourceSet $resourceSet The entity set containing the entity to fetch |
||
315 | * @param object $sourceEntityInstance The source entity instance |
||
316 | * @param object $data The New data for the entity instance. |
||
317 | * |
||
318 | * returns object|null returns the newly created model if sucessful or null if model creation failed. |
||
319 | */ |
||
320 | public function createResourceforResourceSet( |
||
327 | } |
||
328 |
create_function
can pose a great security vulnerability as it is similar toeval
, and could be used for arbitrary code execution. We highly recommend to use a closure instead.