Fast route with two placeholders

I want to use two placeholders within a fast route in zend expressive / laminas mezzio.


$app->get('/api/users/{userId:\d+}/pages/[{id:\d+}]', [App\Page\PageHandler::class], 'api.pages');


            '__class__' => RouteBasedResourceMetadata::class,
            'resource_class' => Page\PageEntity::class,
            'route' => '',
            'extractor' => ObjectPropertyHydrator::class,
             '__class__' => RouteBasedCollectionMetadata::class,
             'collection_class' => Page\PageCollection::class,
             'collection_relation' => 'pages',
             'route' => 'api.pages',

This error occurs:

Route expects at least parameter values for [userId,id], but received [id]

There is a problem with the mapping…

How can I add a second paramtere in de Metadata Mapping? I thought there would be an auto-mapping…

I found a solution:


if (isset($data[$resourceIdentifier])) {
    $routeParams[$routeIdentifier] = $data[$resourceIdentifier];

// Auto inject all entity keys in route params
foreach($data as $key => $value) {
    $routeParams[$key] = $value;

I think there must be a officel solution to inject route params…