Skip to content

Commit

Permalink
Removing incorrect method implementation.
Browse files Browse the repository at this point in the history
Adding documentation to Component::beforeRedirect()
Adding documentation to ObjectCollection::trigger().
  • Loading branch information
markstory committed Aug 11, 2010
1 parent 4463ff7 commit 74a1294
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
38 changes: 15 additions & 23 deletions cake/libs/controller/component.php
Expand Up @@ -95,7 +95,6 @@ public function __get($name) {
*
* @param object $controller Controller with components to initialize
* @return void
* @access public
* @link http://book.cakephp.org/view/998/MVC-Class-Access-Within-Components
*/
public function initialize(&$controller) { }
Expand All @@ -105,7 +104,6 @@ public function initialize(&$controller) { }
*
* @param object $controller Controller with components to startup
* @return void
* @access public
* @link http://book.cakephp.org/view/998/MVC-Class-Access-Within-Components
*/
public function startup(&$controller) { }
Expand All @@ -116,7 +114,6 @@ public function startup(&$controller) { }
*
* @param object $controller Controller with components to beforeRender
* @return void
* @access public
*/
public function beforeRender(&$controller) { }

Expand All @@ -125,32 +122,27 @@ public function beforeRender(&$controller) { }
*
* @param object $controller Controller with components to shutdown
* @return void
* @access public
*/
function shutdown(&$controller) { }

/**
* Called before Controller::redirect().
* Called before Controller::redirect(). Allows you to replace the url that will
* be redirected to with a new url. The return of this method can either be an array or a string.
*
* If the return is an array and contains a 'url' key. You may also supply the following:
*
* - `status` The status code for the redirect
* - `exit` Whether or not the redirect should exit.
*
* If your response is a string or an array that does not contain a 'url' key it will
* be used as the new url to redirect to.
*
* @param object $controller Controller with components to beforeRedirect
* @return void
* @param mixed $url Either the string or url array that is being redirected to.
* @param int $status The status code of the redirect
* @param bool $exit Will the script exit.
* @return mixed Either an array or null.
*/
public function beforeRedirect(&$controller, $url, $status = null, $exit = true) {
$response = array();

foreach ($this->_primary as $name) {
$component =& $this->_loaded[$name];

if ($component->enabled === true && method_exists($component, 'beforeRedirect')) {
$resp = $component->beforeRedirect($controller, $url, $status, $exit);
if ($resp === false) {
return false;
}
$response[] = $resp;
}
}
return $response;
}

public function beforeRedirect(&$controller, $url, $status = null, $exit = true) {}

}
4 changes: 3 additions & 1 deletion cake/libs/object_collection.php
Expand Up @@ -54,7 +54,9 @@ abstract public function load($name, $options = array(), $enable = true);
*
* - `breakOn` Set to the value or values you want the callback propagation to stop on.
* Defaults to `false`
* - `break` Set to true to enabled breaking.
* - `break` Set to true to enabled breaking. Defaults to `false`.
* - `collectReturn` Set to true to collect the return of each object into an array.
* This array of return values will be returned from the trigger() call. Defaults to `false`.
*
* @param string $callback Method to fire on all the objects. Its assumed all the objects implement
* the method you are calling.
Expand Down

0 comments on commit 74a1294

Please sign in to comment.