From c431ddd22c973c1b797df8edf5e98de2e59578cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Lorenzo=20Rodri=CC=81guez?= Date: Mon, 6 Dec 2010 22:57:09 -0430 Subject: [PATCH] Refactoring Dispatcher::_isPrivate to directly check for controller methods, doing in in the controller could be unnecessary --- lib/Cake/Controller/Controller.php | 7 ++----- lib/Cake/Routing/Dispatcher.php | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index 2580f53d0..c423a9227 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -308,15 +308,12 @@ class Controller extends Object { } if (empty($this->uses)) { $this->modelClass = Inflector::singularize($this->name); + } else { + $this->modelClass = current($this->uses); } $this->modelKey = Inflector::underscore($this->modelClass); $this->Components = new ComponentCollection(); - $childMethods = get_class_methods($this); - $parentMethods = get_class_methods('Controller'); - - $this->methods = array_diff($childMethods, $parentMethods); - if ($request instanceof CakeRequest) { $this->_setRequest($request); } diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php index 251b56f6e..4f56056c8 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -143,7 +143,7 @@ class Dispatcher { $privateAction = in_array($prefix, $prefixes); } } - return $privateAction; + return $privateAction && ! in_array($request->params['action'], get_class_methods('Controller')); } /** @@ -160,7 +160,7 @@ class Dispatcher { $controller->constructClasses(); $controller->startupProcess(); - $methods = array_flip($controller->methods); + $methods = array_flip(get_class_methods($controller)); if (!isset($methods[$request->params['action']])) { if ($controller->scaffold !== false) {