From 4ff2a8101f5c5bbe6f5506cbc1fb45df5ce0774f Mon Sep 17 00:00:00 2001 From: Steve Mareigner Date: Wed, 17 Apr 2019 09:51:14 +0200 Subject: [PATCH] fix CollectionFetch.php --- composer.json | 2 +- src/Entity/Middleware/CollectionFetch.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 48b417e..f22fb35 100644 --- a/composer.json +++ b/composer.json @@ -37,6 +37,6 @@ "slim/slim": "3.*" }, "conflict": { - "wollanup/php-api-rest-swagger": "<0.1" + "wollanup/php-api-rest-swagger": "<0.1.3" } } diff --git a/src/Entity/Middleware/CollectionFetch.php b/src/Entity/Middleware/CollectionFetch.php index 09836ca..3870f68 100644 --- a/src/Entity/Middleware/CollectionFetch.php +++ b/src/Entity/Middleware/CollectionFetch.php @@ -10,6 +10,7 @@ use Eukles\Container\ContainerInterface; use Eukles\Container\ContainerTrait; +use Eukles\Entity\EntityRequestInterface; use Eukles\Service\Router\RouteInterface; use Psr\Http\Message\ResponseInterface; @@ -50,9 +51,11 @@ public function __construct(ContainerInterface $container, RouteInterface $route public function __invoke($request, $response, $next): ResponseInterface { $requestClass = $this->route->getRequestClass(); - /** @var ContainerInterface $this */ + /** @var EntityRequestInterface $requestClassInstance */ + $requestClassInstance = new $requestClass($request); + $requestClassInstance->setContainer($this->getContainer()); $response = $this->container->getEntityFactory()->fetchCollection( - new $requestClass($this->container), + $requestClassInstance, $request, $response, $next,