/** * {@inheritdoc} * * @return Request[] */ public function generate(ResourceInterface $resource = null) { /** @var OperationInterface[] $operations */ $operations = array_merge($resource->getCollectionOperations(), $resource->getItemOperations()); $requests = []; foreach ($operations as $operation) { $route = $operation->getRoute(); foreach ($route->getMethods() as $method) { $request = new Request(); $request->setResource($resource); $request->setId((string) Uuid::uuid4()); $request->setUrl($this->baseUrl . $route->getPath()); $request->setMethod($method); if (isset($operation->getContext()['hydra:title'])) { $request->setName($operation->getContext()['hydra:title']); } $this->requestParser->parse($request); $requests[] = $request; } } return $requests; }