summaryrefslogtreecommitdiffstats
path: root/lib/public/appframework
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-10-16 06:42:09 -0700
committerThomas Müller <thomas.mueller@tmit.eu>2013-10-16 06:42:09 -0700
commitc3f7d22adc59949ad41c33d450b6d3e226cdefdb (patch)
tree07a528f19ee2aff7a0bd8cadb89de4b9851d5cbf /lib/public/appframework
parentdb31541fe13510ca4d1b752d7ac5a08ea8e89310 (diff)
parent8603f956ab5982251de51ea403ee93c840a987ac (diff)
downloadnextcloud-server-c3f7d22adc59949ad41c33d450b6d3e226cdefdb.tar.gz
nextcloud-server-c3f7d22adc59949ad41c33d450b6d3e226cdefdb.zip
Merge pull request #5067 from owncloud/urlParams_fix
Get urlParams registered before Request is instantiated
Diffstat (limited to 'lib/public/appframework')
-rw-r--r--lib/public/appframework/app.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/public/appframework/app.php b/lib/public/appframework/app.php
index d97c5c81848..6ac48bf102a 100644
--- a/lib/public/appframework/app.php
+++ b/lib/public/appframework/app.php
@@ -31,8 +31,11 @@ namespace OCP\AppFramework;
* to be registered using IContainer::registerService
*/
class App {
- public function __construct($appName) {
- $this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName);
+ /**
+ * @param array $urlParams an array with variables extracted from the routes
+ */
+ public function __construct($appName, $urlParams = array()) {
+ $this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams);
}
private $container;
@@ -50,8 +53,8 @@ class App {
* Example code in routes.php of the task app:
* $this->create('tasks_index', '/')->get()->action(
* function($params){
- * $app = new TaskApp();
- * $app->dispatch('PageController', 'index', $params);
+ * $app = new TaskApp($params);
+ * $app->dispatch('PageController', 'index');
* }
* );
*
@@ -59,8 +62,8 @@ class App {
* Example for for TaskApp implementation:
* class TaskApp extends \OCP\AppFramework\App {
*
- * public function __construct(){
- * parent::__construct('tasks');
+ * public function __construct($params){
+ * parent::__construct('tasks', $params);
*
* $this->getContainer()->registerService('PageController', function(IAppContainer $c){
* $a = $c->query('API');
@@ -73,9 +76,8 @@ class App {
* @param string $controllerName the name of the controller under which it is
* stored in the DI container
* @param string $methodName the method that you want to call
- * @param array $urlParams an array with variables extracted from the routes
*/
- public function dispatch($controllerName, $methodName, array $urlParams) {
- \OC\AppFramework\App::main($controllerName, $methodName, $urlParams, $this->container);
+ public function dispatch($controllerName, $methodName) {
+ \OC\AppFramework\App::main($controllerName, $methodName, $this->container);
}
}