views:

186

answers:

1

I attempted to use public function __construct() { } but got the error

ErrorException [ Strict ]: Creating default object from empty value.

The reason behind this is that I use a controller that is protected for logged in users only, I don't want to have to call $this->protect(); from every action in the controller.

Hence my attempt to use a constructor that calls $this->protect();

+1  A: 

Use your logged in safeguard in the before() method...

public function before() {
    parent::before();
    $this->protect();

}
alex