Tuesday, March 3, 2009

Re: I cannot inherit methods from AppController.

Ummmm...
Nevermind me. I apologize for wasting your time. In all my excitement
while learning all of the cool thigs the CakePHP does for
automagically, apparently I assumed that it would put my methods
between the {} in the class declaration for me.
I have been writing Java for a while now and Eclipse would freak out
if I attempted to do some thing like that. In PHP it is perfectly
normal to have functions outside of a class and Eclipse was happy.
'tis sad how much I have come to depend on my IDE.

Thank you guys for for trying to answer my question.

On Mar 3, 1:21 pm, darthmalis <m...@darthmalis.com> wrote:
> When I do that Controller::beforeFilter() is called and
> AppController::beforeFilter() is ignored. By default this is an empty
> method so nothing happens. If I put something in
> Controller::beforeFilter() it is executed skippng over
> AppController::beforeFilter() like it's not there.
>
> Maybe My app_controller.php file is in the wrong place (and still
> allowing mrit fields?!). Where is this file supposed to be? I have
> reade to inhe a few different things an have put it in several places
> with the same result. Maybe if it is in the right place, at least I'll
> be able that out as the problem.
>
> I am using version 1.2.1 and my AppController is currently located in /
> app/controllers/app_controller.php.
>
> On Mar 2, 7:42 pm, Miles J <mileswjohn...@gmail.com> wrote:
>
>
>
> > No you need to call the parent. Heres an example controller:
>
> > class TestController extends AppController {
>
> > function beforeFilter() {
> > parent::beforeFilter();
>
> > }
> > }
>
> > class AppController extends Controller {
>
> > function beforeFilter() {
> > // logic
>
> > }
> > }
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: