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

    Hi All,

    I am trying to use AkActionController::redirectTo() to send users to a login action if they have not authenticated.

    if(!$_SESSION['username']) $AkActionController->redirectto('login');

    The problem is that it is returning a fatal error.

    Fatal error: Call to a member function getProtocol() on a non-object in C:Documents and Settings%USERNAME%workspaceadminlibAkActionController.php on line 778

    And here is the line in question.

    $this->redirectTo($this->Request->getProtocol(). $this->Request->getHostWithPort(). $options);

    The only place I see Request set is at the top of the file as a variable.

    var $Request;

    Any idea what could be wrong with my environment?

    Best Regards,

    ~Casey

    • CommentAuthorKaste
     

    hm,

     if(!$_SESSION['username']) $AkActionController->redirectto('login');
    

    if inside a controller, it should be

     if(!$_SESSION['username']) $this->redirectTo('login');
    

    The only place I see Request set is at the top of the file as a variable.

    $this->Request is set in the process(...)-method. ~line 150