While answering a recent question on stackoverflow (http://
stackoverflow.com/questions/13825073/always-call-a-function-in-
cakephp), I discovered that it seems to be recommended in the cookbook
to always override the AppController beforeFilter() in child
controllers (http://book.cakephp.org/2.0/en/controllers.html#the-app-
controller), even if it is only to call the AppController's
beforeFilter() method like this:

public function beforeFilter() {
    parent::beforeFilter();
}

My feeling is that in OO programming, this is useless, because if we
don't override a method in a child class, the parent method is used.

I do know that when the beforeFilter() method is not overridden in
child controllers, the AppController's beforeFilter() is indeed
called, but as it is recommended in the cookbook, is there any
advantage to do so ? Am I missing something here ?

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.


Reply via email to