Skip to content

Commit 7bf0ee4

Browse files
committed
fix(memcache): Fix some cache async issues
1 parent 3862f6c commit 7bf0ee4

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/Service/Router/Route.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
use Eukles\Entity\EntityFactoryConfig;
1414
use Eukles\Entity\EntityFactoryConfigException as EntityFactoryConfigExceptionAlias;
1515
use Eukles\Entity\EntityRequestInterface;
16-
use Eukles\Entity\Middleware\CollectionFetch;
1716
use Eukles\Entity\Middleware\EntityMiddleware;
1817
use Eukles\RouteMap\RouteMapInterface;
1918
use Eukles\Service\Router\Exception\RouteEmptyValueException;
2019
use Eukles\Service\Router\Middleware\SuccessHeaderLocationMiddleware;
2120
use Eukles\Service\Router\Middleware\SuccessStatusMiddleware;
2221
use Eukles\Slim\DeferredCallable;
2322
use InvalidArgumentException;
23+
use Psr\Http\Message\ResponseInterface;
24+
use Psr\Http\Message\ServerRequestInterface;
2425
use RuntimeException;
2526
use Zend\Permissions\Acl\Role\GenericRole;
2627
use Zend\Permissions\Acl\Role\RoleInterface;
@@ -109,6 +110,17 @@ public function __construct(RouteMapInterface $routeMap, $method)
109110
$this->methods = array_map("strtoupper", $this->methods);
110111
}
111112

113+
public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
114+
{
115+
if (!$this->container instanceof \Psr\Container\ContainerInterface) {
116+
throw new RuntimeException("Container is required to invoke Route");
117+
}
118+
$class = $this->getActionClass();
119+
$this->callable = [new $class($this->container), $this->getActionMethod()];
120+
121+
return parent::__invoke($request, $response);
122+
}
123+
112124
/**
113125
* @param int $status
114126
* @param string $description
@@ -137,9 +149,6 @@ public function addStatus(int $status, string $description = "", $isMainSuccess
137149
*/
138150
public function bindToRouter(RouterInterface $router)
139151
{
140-
$this->callable = sprintf('%s:%s', $this->getActionClass(),
141-
$this->getActionMethod());
142-
143152
$router->addResourceRoute($this);
144153
}
145154

0 commit comments

Comments
 (0)