@@ 193-218 (lines=26) @@ | ||
190 | * @throws ContainerExceptionInterface |
|
191 | * @throws NotFoundExceptionInterface |
|
192 | */ |
|
193 | protected static function readRelationship( |
|
194 | string $index, |
|
195 | string $modelRelName, |
|
196 | string $queryValRulesClass, |
|
197 | ContainerInterface $container, |
|
198 | ServerRequestInterface $request |
|
199 | ): ResponseInterface { |
|
200 | static::assertClassValueDefined(static::API_CLASS); |
|
201 | static::assertClassValueDefined(static::SCHEMA_CLASS); |
|
202 | ||
203 | $api = static::defaultCreateApi($container, static::API_CLASS); |
|
204 | $handler = function () use ($api, $index, $modelRelName) { |
|
205 | return $api->readRelationship($index, $modelRelName); |
|
206 | }; |
|
207 | ||
208 | return static::defaultReadRelationshipWithClosureHandler( |
|
209 | $index, |
|
210 | $handler, |
|
211 | $request->getQueryParams(), |
|
212 | $request->getUri(), |
|
213 | static::defaultCreateQueryParser($container, $queryValRulesClass), |
|
214 | static::defaultCreateParameterMapper($container, static::SCHEMA_CLASS), |
|
215 | $api, |
|
216 | $container->get(EncoderInterface::class) |
|
217 | ); |
|
218 | } |
|
219 | ||
220 | /** |
|
221 | * @param string $index |
|
@@ 232-257 (lines=26) @@ | ||
229 | * @throws ContainerExceptionInterface |
|
230 | * @throws NotFoundExceptionInterface |
|
231 | */ |
|
232 | protected static function readRelationshipIdentifiers( |
|
233 | string $index, |
|
234 | string $modelRelName, |
|
235 | string $queryValRulesClass, |
|
236 | ContainerInterface $container, |
|
237 | ServerRequestInterface $request |
|
238 | ): ResponseInterface { |
|
239 | static::assertClassValueDefined(static::API_CLASS); |
|
240 | static::assertClassValueDefined(static::SCHEMA_CLASS); |
|
241 | ||
242 | $api = static::defaultCreateApi($container, static::API_CLASS); |
|
243 | $handler = function () use ($api, $index, $modelRelName) { |
|
244 | return $api->readRelationship($index, $modelRelName); |
|
245 | }; |
|
246 | ||
247 | return static::defaultReadRelationshipIdentifiersWithClosureHandler( |
|
248 | $index, |
|
249 | $handler, |
|
250 | $request->getQueryParams(), |
|
251 | $request->getUri(), |
|
252 | static::defaultCreateQueryParser($container, $queryValRulesClass), |
|
253 | static::defaultCreateParameterMapper($container, static::SCHEMA_CLASS), |
|
254 | $api, |
|
255 | $container->get(EncoderInterface::class) |
|
256 | ); |
|
257 | } |
|
258 | ||
259 | /** |
|
260 | * @param string $parentIndex |