You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 29, 2020. It is now read-only.
This patch adds a new optional constructor argument to the
`ResourceGeneratorFactory`, a string `$linkGeneratorServiceName`. By
default, it uses `Zend\Expressive\Hal\LinkGenerator` for the value.
Users can, however, specify an alternate service class. This allows
users to vary the `ResourceGenerator` per module or path-segregated
middleware pipeline:
```php
// In configuration:
return [
'dependencies' => [
'factories' => [
\Api\Router::class => FastRouteRouterFactory::class,
\Api\RouteMiddleware::class => new RouteMiddlewareFactory(\Api\Router::class),
\Api\UrlHelper::class => new UrlHelperFactory('/api', \Api\Router::class),
\Api\UrlHelperMiddleware::class => new UrlHelperMiddlewareFactory(\Api\UrlHelper::class),
\Api\UrlGenerator::class => new ExpressiveUrlGeneratorFactory(\Api\UrlHelper::class),
\Api\LinkGenerator::class => new LinkGeneratorFactory(\Api\UrlGenerator::class),
\Api\ResourceGenerator::class => new ResourceGeneratorFactory(\Api\LinkGenerator::class),
],
],
],
```
The factory implements `__set_state()`, allowing serialization via
`var_export()` (the mechanism used by the default expressive
configuration caching mechanism).
0 commit comments