Skip to content

Commit

Permalink
Pulling construction of Scaffold into a method so its
Browse files Browse the repository at this point in the history
easier to allow plugins/user classes to replace the core Scaffold class.
  • Loading branch information
markstory committed Jul 23, 2011
1 parent b569313 commit f28b42d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/Cake/Controller/Controller.php
Expand Up @@ -464,7 +464,7 @@ public function invokeAction(CakeRequest $request) {

} catch (ReflectionException $e) {
if ($this->scaffold !== false) {
return new Scaffold($this, $request);
return $this->_getScaffold($request);
}
throw new MissingActionException(array(
'controller' => $this->name . "Controller",
Expand All @@ -474,8 +474,8 @@ public function invokeAction(CakeRequest $request) {
}

/**
* 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.
Expand All @@ -497,6 +497,17 @@ protected function _isPrivateAction(ReflectionMethod $method, CakeRequest $reque
}
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.
*
Expand Down

0 comments on commit f28b42d

Please sign in to comment.