[Pkg-owncloud-commits] [owncloud] 24/121: use id instead of resourceId

David Prévot taffit at moszumanska.debian.org
Thu Aug 21 16:44:27 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 3c68defac2e0c66dfd062a22c859872fb99c99a0
Author: Bernhard Posselt <dev at bernhard-posselt.com>
Date:   Thu Jun 26 14:20:35 2014 +0200

    use id instead of resourceId
---
 lib/private/appframework/routing/routeconfig.php | 12 +-----------
 tests/lib/appframework/routing/RoutingTest.php   |  4 ++--
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/lib/private/appframework/routing/routeconfig.php b/lib/private/appframework/routing/routeconfig.php
index 634bc88..5b4d411 100644
--- a/lib/private/appframework/routing/routeconfig.php
+++ b/lib/private/appframework/routing/routeconfig.php
@@ -122,14 +122,13 @@ class RouteConfig {
 		foreach ($resources as $resource => $config) {
 
 			// the url parameter used as id to the resource
-			$resourceId = $this->buildResourceId($resource);
 			foreach($actions as $action) {
 				$url = $config['url'];
 				$method = $action['name'];
 				$verb = isset($action['verb']) ? strtoupper($action['verb']) : 'GET';
 				$collectionAction = isset($action['on-collection']) ? $action['on-collection'] : false;
 				if (!$collectionAction) {
-					$url = $url . '/' . $resourceId;
+					$url = $url . '/{id}';
 				}
 				if (isset($action['url-postfix'])) {
 					$url = $url . '/' . $action['url-postfix'];
@@ -169,15 +168,6 @@ class RouteConfig {
 	}
 
 	/**
-	 * Generates the id used in the url part o the route url
-	 * @param string $resource
-	 * @return string
-	 */
-	private function buildResourceId($resource) {
-		return '{' . $this->underScoreToCamelCase($resource) . 'Id}';
-	}
-
-	/**
 	 * Underscored strings are converted to camel case strings
 	 * @param string $str
 	 * @return string
diff --git a/tests/lib/appframework/routing/RoutingTest.php b/tests/lib/appframework/routing/RoutingTest.php
index 89cc77d..7cd07db 100644
--- a/tests/lib/appframework/routing/RoutingTest.php
+++ b/tests/lib/appframework/routing/RoutingTest.php
@@ -78,14 +78,14 @@ class RoutingTest extends \PHPUnit_Framework_TestCase
 	{
 		$routes = array('resources' => array('account' => array('url' => '/accounts')));
 
-		$this->assertResource($routes, 'account', '/accounts', 'AccountController', 'accountId');
+		$this->assertResource($routes, 'account', '/accounts', 'AccountController', 'id');
 	}
 
 	public function testResourceWithUnderScoreName()
 	{
 		$routes = array('resources' => array('admin_accounts' => array('url' => '/admin/accounts')));
 
-		$this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'adminAccountsId');
+		$this->assertResource($routes, 'admin_accounts', '/admin/accounts', 'AdminAccountsController', 'id');
 	}
 
 	/**

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list