@@ 200-226 (lines=27) @@ | ||
197 | * @throws ContainerExceptionInterface |
|
198 | * @throws NotFoundExceptionInterface |
|
199 | */ |
|
200 | protected static function readRelationship( |
|
201 | string $index, |
|
202 | string $modelRelName, |
|
203 | string $queryValRulesClass, |
|
204 | ContainerInterface $container, |
|
205 | ServerRequestInterface $request |
|
206 | ): ResponseInterface { |
|
207 | static::assertClassValueDefined(static::API_CLASS); |
|
208 | static::assertClassValueDefined(static::SCHEMA_CLASS); |
|
209 | ||
210 | $api = static::defaultCreateApi($container, static::API_CLASS); |
|
211 | $handler = function () use ($api, $index, $modelRelName) { |
|
212 | return $api->readRelationship($index, $modelRelName); |
|
213 | }; |
|
214 | ||
215 | return static::defaultReadRelationshipWithClosureHandler( |
|
216 | $handler, |
|
217 | $request->getQueryParams(), |
|
218 | $request->getUri(), |
|
219 | static::defaultCreateQueryParser($container, $queryValRulesClass), |
|
220 | static::defaultCreateParameterMapper($container, static::SCHEMA_CLASS), |
|
221 | $api, |
|
222 | $container->get(SettingsProviderInterface::class), |
|
223 | $container->get(JsonSchemasInterface::class), |
|
224 | $container->get(EncoderInterface::class) |
|
225 | ); |
|
226 | } |
|
227 | ||
228 | /** |
|
229 | * @param string $index |
|
@@ 240-266 (lines=27) @@ | ||
237 | * @throws ContainerExceptionInterface |
|
238 | * @throws NotFoundExceptionInterface |
|
239 | */ |
|
240 | protected static function readRelationshipIdentifiers( |
|
241 | string $index, |
|
242 | string $modelRelName, |
|
243 | string $queryValRulesClass, |
|
244 | ContainerInterface $container, |
|
245 | ServerRequestInterface $request |
|
246 | ): ResponseInterface { |
|
247 | static::assertClassValueDefined(static::API_CLASS); |
|
248 | static::assertClassValueDefined(static::SCHEMA_CLASS); |
|
249 | ||
250 | $api = static::defaultCreateApi($container, static::API_CLASS); |
|
251 | $handler = function () use ($api, $index, $modelRelName) { |
|
252 | return $api->readRelationship($index, $modelRelName); |
|
253 | }; |
|
254 | ||
255 | return static::defaultReadRelationshipIdentifiersWithClosureHandler( |
|
256 | $handler, |
|
257 | $request->getQueryParams(), |
|
258 | $request->getUri(), |
|
259 | static::defaultCreateQueryParser($container, $queryValRulesClass), |
|
260 | static::defaultCreateParameterMapper($container, static::SCHEMA_CLASS), |
|
261 | $api, |
|
262 | $container->get(SettingsProviderInterface::class), |
|
263 | $container->get(JsonSchemasInterface::class), |
|
264 | $container->get(EncoderInterface::class) |
|
265 | ); |
|
266 | } |
|
267 | ||
268 | /** @noinspection PhpTooManyParametersInspection |
|
269 | * @param $parentIndex |