Skip to content

Iri converter unable to generate @id if collection path has necceserry parameters #884

Description

@ihorsamusenko

I have such an annotation

* collectionOperations={
*          "get" = {"method" = "GET", "path"="/users/{id}/badges"}
*     }

But it says

Unable to generate an IRI for "{MyClass}"

This is happening due to these lines (parameters are not passed)

    public function getIriFromResourceClass(string $resourceClass, int $referenceType = UrlGeneratorInterface::ABS_PATH): string
    {
        try {
            return $this->router->generate($this->routeNameResolver->getRouteName($resourceClass, true), [], $referenceType);
        } catch (RoutingExceptionInterface $e) {
            throw new InvalidArgumentException(sprintf('Unable to generate an IRI for "%s".', $resourceClass), $e->getCode(), $e);
        }
    }

What do you think about passing a query from the current request there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions