From a9d2078d2517649a9d6bc7310d8b11c8dffdd066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Lorenzo=20Rodri=CC=81guez?= Date: Tue, 22 Feb 2011 00:13:35 -0430 Subject: [PATCH] Revert "Refactoring Dispatcher::_isPrivate to directly check for controller methods, doing in in the controller could be unnecessary" This reverts commit c431ddd22c973c1b797df8edf5e98de2e59578cd. Conflicts: lib/Cake/Routing/Dispatcher.php --- lib/Cake/Controller/Controller.php | 7 +++++-- lib/Cake/Routing/Dispatcher.php | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index 039d7ae09..c34a3bc81 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -319,12 +319,15 @@ 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 6fceec3d7..2cc41f173 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -142,7 +142,7 @@ class Dispatcher { } } - return $privateAction || in_array($request->params['action'], get_class_methods('Controller')); + return $privateAction; } /** @@ -159,7 +159,7 @@ class Dispatcher { $controller->constructClasses(); $controller->startupProcess(); - $methods = array_flip(get_class_methods($controller)); + $methods = array_flip($controller->methods); if (!isset($methods[$request->params['action']])) { if ($controller->scaffold !== false) {