You call it as parent::beforeFilter(), not
AppController::beforeFilter(). parent is a keyword that refers to the
class that some other class extends.
And use parent::beforeFilter() only if the your controller also has a
beforeFilter() method. If it does not, AppController's beforeFilter()
will be called anyway because Cake will call it on whatever controller
the request is using. Because each controller *extends* AppController,
the latter's version will be called if there isn't one in this other
controller.
If you do have a beforeFilter(), you are overriding the parent's (ie.
AppController) version. So, in this case, you should make a call to it
before any of the other logic. For example:
class FoosController extends AppController
{
/* this method overrides AppController::beforeFilter()
*/
function beforeFilter()
{
/* call the parent's version
*/
parent::beforeFilter();
// other logic here
}
// etc.
}
On Thu, Jul 30, 2009 at 5:11 AM,
DatacenterHellas<[email protected]> wrote:
>
> What I done is
>
> AppController::beforeFilter();
>
> Is that incorect ? ? ?
>
> What is the deference of the parent::beforeFilter();
>
> The pr($this) is only for test :)
>
> Kind regards
> Merianos Nikos
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---