I think the term is "overriding" ( http://en.wikipedia.org/wiki/Method_overriding_(programming) ).
On Sep 19, 2:28 pm, "Chris Hartjes" <[EMAIL PROTECTED]> wrote: > On 9/19/07, MikeK <[EMAIL PROTECTED]> wrote: > > > > > I have a beforeFilter in app_controller and in some other controllers, > > but have noticed that the beforeFilter in app_controller does NOT run > > when the requested controller has it's own beforeFilter. > > > I am running the latest Alpha code for 1.2. I saw from another post > > the solution of putting a call to parent::beforeFilter() in the > > "child" controller, and while this works, my question is WHY? > > > I was hoping/expecting that the beforeFilter in app_controller would > > always be called first, then the beforeFilter of the requested action > > would be invoked. Any explanation is greatly appreciated. > > Your beforeFilter() in the child replaces the beforeFilter() in > app_controller. It's a basic principle of object oriented > programming, where you are "overloading" existing methods inherited by > the child from the parent. That's why you have to statically call the > app_controller beforeFilter() method from child controller. > > -- > Chris Hartjes > Senior Developer > Cake Development Corporation > > My motto for 2007: "Just build it, damnit!" > > @TheBallpark -http://www.littlehart.net/attheballpark > @TheKeyboard -http://www.littlehart.net/atthekeyboard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
