NotFoundHttpException with ApiPlatform: Custom URL Parameter Treated as Identifier

I’m encountering an issue within my Symfony project that utilizes ApiPlatform. Whenever I include a custom parameter in the URL, I face a NotFoundHttpException with the message “Invalid URI variables”. It seems that ApiPlatform, within Symfony, is interpreting my custom URL parameter as an identifier instead of a variable.

Here’s a snippet of the relevant code:

#[ApiResource(
    operations: [
        new GetCollection(
            uriTemplate: '/{tenant}/agreement',
            openapi: new ModelOperation(
                parameters: [
                    new ModelParameter(
                        name: 'tenant',
                        in: 'path',
                        required: true,
                    ),
                ],
            ),
        ),
    ]
)]

My goal is to include this custom parameter in the SQL query condition for retrieving the collection.

I suspect that ApiPlatform might be misinterpreting the parameter configuration. I’m seeking guidance on how to address this issue and ensure that ApiPlatform correctly handles the custom URL parameter as a variable rather than an identifier. Any advice or insights on resolving this matter would be highly appreciated. Thank you!