Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Session troubles

I'm trying to store values in the session to be used elsewhere by various views and controllers. problem is, I don't appear to be actually storing any information. So, here's where I setup the session in the bootstrap:

$di->setShared('session', function() {
    $session = new \Phalcon\Session\Adapter\Files();
    $session->start();
    return $session;
});

Later, in the LoginController, I'm trying to stash data in the session:

                    $this->session->set('userid',$user->ID);

but, on further inspection when interrupting the process (and why this data is never stored) I found this when analyzing the login controller's output:

Notice: Trying to get property of non-object in C:\workspace\GIIAnalytics\app\controllers\LoginController.php on line 32

line 32 is the one pasted above. I don't understand what I'm missing here. Any help would be appreciated.

Try this in LoginController

var_dump($this->session, $user);

Check both vars has the right type and tell us



263
Accepted
answer

rookie mistake there, $user was acceually an assoc. array. Thanks.

Try this in LoginController

var_dump($this->session, $user);

Check both vars has the right type and tell us