Pulling construction of Scaffold into a method so its

easier to allow plugins/user classes to replace the core Scaffold class.
This commit is contained in:
mark_story 2011-07-10 11:07:49 -04:00 committed by mark_story
parent b56931383c
commit f28b42de2f

View file

@ -464,7 +464,7 @@ class Controller extends Object {
} catch (ReflectionException $e) {
if ($this->scaffold !== false) {
return new Scaffold($this, $request);
return $this->_getScaffold($request);
}
throw new MissingActionException(array(
'controller' => $this->name . "Controller",
@ -474,8 +474,8 @@ class Controller extends Object {
}
/**
* Check if the request's action is marked as private, with an underscore, of if the request is attempting to
* directly accessing a prefixed action.
* Check if the request's action is marked as private, with an underscore,
* or if the request is attempting to directly accessing a prefixed action.
*
* @param ReflectionMethod $method The method to be invoked.
* @param CakeRequest $request The request to check.
@ -497,6 +497,17 @@ class Controller extends Object {
}
return $privateAction;
}
/**
* Returns a scaffold object to use for dynamically scaffolded controllers.
*
* @param CakeRequest $request
* @return Scaffold
*/
protected function _getScaffold(CakeRequest $request) {
return new Scaffold($this, $request);
}
/**
* Merge components, helpers, and uses vars from Controller::$_mergeParent and PluginAppController.
*