Refactoring Dispatcher::_isPrivate to directly check for controller methods, doing in in the controller could be unnecessary

This commit is contained in:
José Lorenzo Rodríguez 2010-12-06 22:57:09 -04:30
parent 1d67d1611c
commit c431ddd22c
2 changed files with 4 additions and 7 deletions

View file

@ -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);
}

View file

@ -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) {