Skip to content

Commit 29f9937

Browse files
committed
feat(provider): Auto Resolve Get Operation and Parameters
1 parent d980afd commit 29f9937

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/EventListener/ReadListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use ApiPlatform\Metadata\Put;
2222
use ApiPlatform\Metadata\Get;
2323
use ApiPlatform\Metadata\Link;
24+
use ApiPlatform\Metadata\Resource\Factory\OperationDefaultsTrait;
2425
use ApiPlatform\Metadata\Resource\Factory\ResourceMetadataCollectionFactoryInterface;
2526
use ApiPlatform\Serializer\SerializerContextBuilderInterface;
2627
use ApiPlatform\State\ProviderInterface;
@@ -115,8 +116,7 @@ public function onKernelRequest(RequestEvent $event): void
115116
$operationUriVariables = $uriVariable->getIdentifiers();
116117
$relationClass = $uriVariable->getFromClass();
117118
try {
118-
//$uriVariables = $this->getOperationUriVariables($operation, $parameters, $resourceClass);
119-
$tmp = $this->provider->provide(new Get(uriVariables: $operationUriVariables, class: $relationClass, provider: ItemProvider::class), ['id' => $parameters[$key]], $context);
119+
$tmp = $this->provider->provide($this->resourceMetadataCollectionFactory->create($relationClass)->getOperation(null, false, true), [$uriVariable->getIdentifiers()[0] => $parameters[$key]], $context);
120120
$request->attributes->set($uriVariable->getToProperty(), $tmp);
121121
} catch (InvalidIdentifierException|InvalidUriVariableException $e) {
122122
throw new NotFoundHttpException('Invalid identifier value or configuration.', $e);

0 commit comments

Comments
 (0)