This saves the cost of doing reflection on each request. Because the core components don't need any RAD affordances we can hardcode the callback listeners and get a tiny performance increase.
@@ -273,6 +273,18 @@ class AuthComponent extends Component {
}
/**
+ * Events supported by this component.
+ *
+ * @return array
+ */
+ public function implementedEvents() {
+ return [
+ 'Controller.initialize' => 'initialize',
+ 'Controller.startup' => 'startup',
+ ];
+ }
+
+/**
* Checks whether current action is accessible without authentication.
*
* @param Controller $controller A reference to the instantiating controller object
@@ -154,6 +154,17 @@ class CookieComponent extends Component {
* Write a value to the $_COOKIE[$key];
* Optional [Name.], required key, optional $value, optional $encrypt, optional $expires
@@ -96,6 +96,17 @@ class CsrfComponent extends Component {
* Set the cookie in the response.
* Also sets the request->params['_csrfToken'] so the newly minted
@@ -56,6 +56,15 @@ class PaginatorComponent extends Component {
);
+ return [];
* Handles automatic pagination of model records.
* ## Configuring pagination
@@ -125,7 +134,7 @@ class PaginatorComponent extends Component {
* {{{
* $query = $this->Articles->find('popular')->matching('Tags', function($q) {
- * return $q->where(['name' => 'CakePHP'])
+ * return $q->where(['name' => 'CakePHP'])
* });
* $results = $paginator->paginate($query);
* }}}
@@ -128,6 +128,20 @@ class RequestHandlerComponent extends Component {
+ 'Controller.beforeRender' => 'beforeRender',
+ 'Controller.beforeRedirect' => 'beforeRedirect',
* Checks to see if a specific content type has been requested and sets RequestHandler::$ext
* accordingly. Checks the following in order: 1. The '_ext' value parsed by the Router. 2. A specific
* AJAX type request indicated by the presence of a header. 3. The Accept header. With the exception
@@ -130,6 +130,17 @@ class SecurityComponent extends Component {
* Sets the actions that require a request that is SSL-secured, or empty for all actions
* @param string|array $actions
@@ -185,4 +185,13 @@ class SessionComponent extends Component {
return Session::started();