Skip to content

Commit

Permalink
Fixed bug for routerService dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
xujiajun committed Oct 23, 2017
1 parent 83f573a commit 0ad4b00
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Framework/Router/RouterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,18 +189,19 @@ public function dispatch($container)
if (isset($parameters[$paramName])) {
$args[$paramName] = $parameters[$paramName];
}

if (!empty($arg->getClass()) && $arg->getClass()->getName() == (ServerRequestInterface::class)) {
$container['psr7Factory'] = new DiactorosFactory();
$container['httpFoundationFactory'] = new HttpFoundationFactory();
$container['Request'] = RequestAdapter::convertPsr7Request(Request::createFromGlobals());
$args[$paramName] = $container['Request'];
}

if (!empty($arg->getClass()) && $arg->getClass()->getName() == (Request::class || \Symfony\Component\HttpFoundation\Request::class)) {
if (!empty($arg->getClass()) && (($arg->getClass()->getName() == Request::class)
|| ($arg->getClass()->getName() == \Symfony\Component\HttpFoundation\Request::class))) {
$args[$paramName] = $container['symfonyRequest'];
}
}

return $method->invokeArgs($instance, $args);
}
}
Expand Down

0 comments on commit 0ad4b00

Please sign in to comment.