# Fast route with two placeholders

**URL:** <https://discourse.laminas.dev/t/fast-route-with-two-placeholders/1403>\
**Category:** Mezzio\
**Created:** [February 26, 2020, 3:36am UTC](https://discourse.laminas.dev/t/fast-route-with-two-placeholders/1403 "2020-02-26T03:36:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xha1](https://avatars.discourse-cdn.com/v4/letter/x/c4cdca/32.png) [@xha1](https://discourse.laminas.dev/u/xha1)\
**Post date:** [February 26, 2020, 3:36am UTC](https://discourse.laminas.dev/t/fast-route-with-two-placeholders/1403/1 "2020-02-26T03:36:11Z")

</div>

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

routes.php

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

ConfigProvider.php

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

```

This error occurs:

`Route `api.page` 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…

---

<div class="post-metadata">

**Author:** ![xha1](https://avatars.discourse-cdn.com/v4/letter/x/c4cdca/32.png) [@xha1](https://discourse.laminas.dev/u/xha1)\
**Post date:** [February 28, 2020, 4:29am UTC](https://discourse.laminas.dev/t/fast-route-with-two-placeholders/1403/2 "2020-02-28T04:29:30Z")

</div>

I found a solution:

RouteBasedResourceStrategy.php

```
...
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…
