]> source.dussan.org Git - nextcloud-server.git/commitdiff
use id instead of resourceId
authorBernhard Posselt <dev@bernhard-posselt.com>
Thu, 26 Jun 2014 12:20:35 +0000 (14:20 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 7 Aug 2014 08:19:07 +0000 (10:19 +0200)
lib/private/appframework/routing/routeconfig.php
tests/lib/appframework/routing/RoutingTest.php

index 634bc888bdb8e1751d894a908fe26be559b663fd..5b4d411a3553243bb36064c0181bc6ed58874cb5 100644 (file)
@@ -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'];
@@ -168,15 +167,6 @@ class RouteConfig {
                return $this->underScoreToCamelCase($action);
        }
 
-       /**
-        * 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
index 89cc77d684a572da2802c93da8852f1f33eb7ed7..7cd07db6ce1ef0a03badb798a2b9c529a3a1d913 100644 (file)
@@ -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');
        }
 
        /**