Skip to content

Commit

Permalink
Nette\Application\Application: removed setContext(), getService(), se…
Browse files Browse the repository at this point in the history
…tRouter() and DI container is passed in constructor (possible BC break)
  • Loading branch information
dg committed May 9, 2011
1 parent 5bc6b28 commit a3555c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 40 deletions.
44 changes: 7 additions & 37 deletions Nette/Application/Application.php
Expand Up @@ -60,6 +60,13 @@ class Application extends Nette\Object



public function __construct(Nette\DI\IContainer $context)
{
$this->context = $context;
}



/**
* Dispatch a HTTP request to a front controller.
* @return void
Expand Down Expand Up @@ -222,18 +229,6 @@ final public function getPresenter()



/**
* Sets the context.
* @return Application provides a fluent interface
*/
public function setContext(Nette\DI\IContainer $context)
{
$this->context = $context;
return $this;
}



/**
* Gets the context.
* @return Nette\DI\IContainer
Expand All @@ -245,18 +240,6 @@ final public function getContext()



/**
* Gets the service object of the specified type.
* @param string service name
* @return object
*/
final public function getService($name)
{
return $this->context->getService($name);
}



/**
* Returns router.
* @return IRouter
Expand All @@ -268,19 +251,6 @@ public function getRouter()



/**
* Changes router.
* @param IRouter
* @return Application provides a fluent interface
*/
public function setRouter(IRouter $router)
{
$this->context->addService('Nette\\Application\\IRouter', $router);
return $this;
}



/**
* Returns presenter factory.
* @return IPresenterFactory
Expand Down
3 changes: 1 addition & 2 deletions Nette/DI/Configurator.php
Expand Up @@ -299,8 +299,7 @@ public static function createApplication(IContainer $container, array $options =
: Nette\Application\UI\Presenter::INVALID_LINK_WARNING;

$class = isset($options['class']) ? $options['class'] : 'Nette\Application\Application';
$application = new $class;
$application->setContext($container);
$application = new $class($container);
$application->catchExceptions = Environment::isProduction();
return $application;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Nette/Application.UI/Presenter.link().phpt
Expand Up @@ -168,7 +168,7 @@ $url->setScriptPath('/index.php');
$context = Environment::getContext()->addService('Nette\\Web\\IHttpRequest', new Http\Request($url));

$application = Environment::getApplication();
$application->setRouter(new Application\Routers\SimpleRouter());
$application->router[] = new Application\Routers\SimpleRouter();

$request = new Application\Request('Test', Http\Request::GET, array());

Expand Down

0 comments on commit a3555c7

Please sign in to comment.