Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorkkrzyzak
     

    •  
      CommentAuthorriffed
     

    Is the parent constructor being called? BTW, AK was made to be compatible with PHP 4, which doesn't have __constructor.

    • CommentAuthorkkrzyzak
     

    Is the parent constructor being called? yes... well, actually, constructor creates this error(I mean, if I create: function __construct(){ $this->user = new User; if(!$this->user->isAdmin() ){ $this->redirectTo(array('controller'=>'user', 'action'=>'login') ); } } I've got the same result as with calling $this->checkUser(); )

    •  
      CommentAuthorriffed
     

    Sorry if I'm being dense, but are you calling the constructor for AkApplicationController ?

    • CommentAuthorkkrzyzak
     

    •  
      CommentAuthorriffed
     

    I think you have to call the parent constructor before you make calls to the model.

    • CommentAuthorkkrzyzak
     

    •  
      CommentAuthorriffed
     

    Maybe Bermi can shed some light.

    •  
      CommentAuthorbermi
     

    @kkrzyzak You might better user a controller filter like:

    function __construct(){
        $this->beforeFilter(array('_authenticate'=>array('except'=>array('authenticate'))));
    }
    
    function _authenticate(){
         $this->user = new User;
         if(!$this->user->isAdmin()){
             $this->redirectTo(array('controller'=>'user', 'action'=>'login') );
             return false;
         }
    }
    

    You can read more about Akelos controller filters on the wiki.

    •  
      CommentAuthorriffed
     

    Thanks bermi.

    • CommentAuthorkkrzyzak
     

    thanks bermi, it works ;)