mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-08 00:34:42 +03:00
Make "ControllerResolver" implements "RouterAwareInterface"
This commit is contained in:
parent
42c1d4e340
commit
184e6ccdc3
@ -153,6 +153,11 @@ class Application implements RouterAwareInterface
|
|||||||
public function setRouter(RouterInterface $router)
|
public function setRouter(RouterInterface $router)
|
||||||
{
|
{
|
||||||
$this->router = $router;
|
$this->router = $router;
|
||||||
|
|
||||||
|
// Update router in internal objects
|
||||||
|
if (!is_null($this->controllerResolver)) {
|
||||||
|
$this->controllerResolver->setRouter($router);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,7 @@ use Mibew\Routing\RouterAwareInterface;
|
|||||||
use Symfony\Component\Routing\RouterInterface;
|
use Symfony\Component\Routing\RouterInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
class ControllerResolver
|
class ControllerResolver implements RouterAwareInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var RouterInterface|null
|
* @var RouterInterface|null
|
||||||
@ -48,6 +48,22 @@ class ControllerResolver
|
|||||||
$this->authenticationManager = $manager;
|
$this->authenticationManager = $manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getRouter()
|
||||||
|
{
|
||||||
|
return $this->router;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setRouter(RouterInterface $router)
|
||||||
|
{
|
||||||
|
$this->router = $router;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves controller by request.
|
* Resolves controller by request.
|
||||||
*
|
*
|
||||||
@ -102,7 +118,7 @@ class ControllerResolver
|
|||||||
|
|
||||||
$object = new $class();
|
$object = new $class();
|
||||||
if ($object instanceof RouterAwareInterface) {
|
if ($object instanceof RouterAwareInterface) {
|
||||||
$object->setRouter($this->router);
|
$object->setRouter($this->getRouter());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object instanceof AuthenticationManagerAwareInterface) {
|
if ($object instanceof AuthenticationManagerAwareInterface) {
|
||||||
|
Loading…
Reference in New Issue
Block a user