Skip to content

Commit

Permalink
Dispatcher now creates the controller unsing dependency container
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe Silva committed Jun 20, 2016
1 parent 079feb8 commit a04fca9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Application.php
Expand Up @@ -11,6 +11,7 @@

use Interop\Container\ContainerInterface;
use Slick\Configuration\Configuration;
use Slick\Di\Container;
use Slick\Di\ContainerBuilder;
use Slick\Http\PhpEnvironment\MiddlewareRunnerInterface;
use Slick\Http\PhpEnvironment\Request;
Expand Down Expand Up @@ -75,7 +76,7 @@ public function __construct(Request $request = null)
/**
* Gets the application dependency injection container
*
* @return ContainerInterface
* @return ContainerInterface|Container
*/
public function getContainer()
{
Expand All @@ -98,7 +99,7 @@ public static function setContainer(ContainerInterface $container)
/**
* Returns the application dependency container
*
* @return ContainerInterface
* @return ContainerInterface|Container
*/
public static function container()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Dispatcher.php
Expand Up @@ -131,7 +131,7 @@ protected function setViewVars(
protected function createController($controller)
{
$this->checkClass($controller);
$handler = new $controller;
$handler = Application::container()->make($controller);
if (! $handler instanceof ControllerInterface) {
throw new InvalidControllerException(
"The class '{$controller}' does not implement ControllerInterface."
Expand Down

0 comments on commit a04fca9

Please sign in to comment.