Skip to content

Commit

Permalink
Remove all container set
Browse files Browse the repository at this point in the history
  • Loading branch information
Gianluca Arbezzano committed Oct 2, 2015
1 parent d1f4a1c commit b1b5eed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ class App
public function __construct(ContainerInterface $container = null)
{
$this->container = $container ?: Container\PHPDiFactory::buildContainer(Loader::load());
$container = &$this->container;

if ($container->has('router') == false) {
throw new Exception('Define router config');
}

$container->set('di', $container);
}

/**
Expand Down
16 changes: 10 additions & 6 deletions src/Container/PHPDiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ public static function buildContainer($config = [])
{
$builder = new DI\ContainerBuilder();
$builder->useAnnotations(true);
$builder->addDefinitions([
"event_manager" => DI\object('Zend\EventManager\EventManager'),
"dispatcher" => DI\object('GianArb\Penny\Dispatcher')
->constructor(DI\get('router')),
]);
$builder->addDefinitions(
[
"event_manager" => DI\object('Zend\EventManager\EventManager'),
"dispatcher" => DI\object('GianArb\Penny\Dispatcher')
->constructor(DI\get('router')),
]
);
$builder->addDefinitions($config);
$container = $builder->build();
$container->set('di', $container);

return $builder->build();
return $container;
}
}

0 comments on commit b1b5eed

Please sign in to comment.