Skip to content
Snippets Groups Projects
Commit 0c444fb2 authored by Arthur Schiwon's avatar Arthur Schiwon
Browse files

Merge pull request #8017 from Raydiation/master

Remove dependency on container, removing service locator antipattern
parents e295d48f 5f3b8c45
No related branches found
No related tags found
No related merge requests found
...@@ -38,10 +38,10 @@ use OCP\IRequest; ...@@ -38,10 +38,10 @@ use OCP\IRequest;
abstract class Controller { abstract class Controller {
/** /**
* app container for dependency injection * app name
* @var \OCP\AppFramework\IAppContainer * @var string
*/ */
protected $app; protected $appName;
/** /**
* current request * current request
...@@ -51,11 +51,11 @@ abstract class Controller { ...@@ -51,11 +51,11 @@ abstract class Controller {
/** /**
* constructor of the controller * constructor of the controller
* @param IAppContainer $app interface to the app * @param string $appName the name of the app
* @param IRequest $request an instance of the request * @param IRequest $request an instance of the request
*/ */
public function __construct(IAppContainer $app, IRequest $request){ public function __construct($appName, IRequest $request){
$this->app = $app; $this->appName = $appName;
$this->request = $request; $this->request = $request;
} }
...@@ -136,7 +136,7 @@ abstract class Controller { ...@@ -136,7 +136,7 @@ abstract class Controller {
*/ */
public function render($templateName, array $params=array(), public function render($templateName, array $params=array(),
$renderAs='user', array $headers=array()){ $renderAs='user', array $headers=array()){
$response = new TemplateResponse($this->app->getAppName(), $templateName); $response = new TemplateResponse($this->appName, $templateName);
$response->setParams($params); $response->setParams($params);
$response->renderAs($renderAs); $response->renderAs($renderAs);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment