0
votes

I have a table called settings. I created a controller for this as settings controller.

<?php 
      class SettingsController extends AppController {
         ....
         ....
      }
?>

By default I have app controller

<?php
     class AppController extends Controller {
        ....
        ....
     }
?>

In app controller I put some logic in beforeFilter method which is common for all controllers, Now I have to user some logics in beforeFilter in settings controller. But, I am unable to do so.. If I put beforeFilter in settings controller it doesn't access logics from appController before filetr,

Can anyone advice regarding this?

1

1 Answers

1
votes

Can anyone advice regarding this?

Yes, learn about the basics of OOP in php first before trying to use an OOP based framework. Especially pay attention to the overloading section for what you want to do.

SettingsController already inherits the code from AppController because it extends it. The examples in the manual of the framework should already show you this:

public function beforeFilter() {
    // Your code here
    parent::beforeFilter();
    // Your code here
}

You need to call the parent method.