How to use Session Files in Phalcon 4.0?

Hi all. I'm trying the new version of Phalcon and I do not know how to make the sessions work.

This code produces: Call to undefined method Phalcon\Session\Manager::setAdapter(). If I change setAdapter by setHandler it produces a 500 error.

$adapter = new Phalcon\Session\Adapter\Files();
$session = new Phalcon\Session\Manager();
$session->setAdapter($adapter);
$session->start();
/**/
$session->set('uid', 1);
/**/
if ($session->has('uid')) {
    echo $session->get('uid');
}


401

I have this problem too, i already checked exits() too and received "Call to undefined method". I think 4.0 alpha 1 built before some method add to current branch. We must wait some update versions in future!!

Note that only the first alpha has been released for 4.0. There's probably a lot of stuff broken - I wouldn't recommend using it for production, or even development yet - unless you're checking the functionality of a particular piece.

edited Feb '19

... create a new thread here- https://forum.phalconphp.com/discussion/19411/phalcon-400-alpha-2-new-session-generated-in-every-page-refresh

Hi there,

I am trying to test a project and prepare for 4.0- change a lot of stuff for migration. But... cant figure out how to fix session. (my security tokens cant pass, so.. find that issue)

My code for now is (depending of unit tests):

$session = new \Phalcon\Session\Manager();
$session->setOptions([
 'uniqueId' => 'test-id' 
]);

$session->setHandler(new \Phalcon\Session\Adapter\Files());
$session->start();

return $session;

And still session is new every refresh - cant store nothing. Is any ideas?

PS: i am using latest 4.0.0 alpha 2 for Windows

@Boris - if you have a new question, please post a new thread.

edited Feb '19

@Boris - if you have a new question, please post a new thread.

Well... i think is related to this one? is it necessary?

Threads aren't intended to be discussions around a topic - they're meant to help the original poster solve their problem. Posting a new question on a month old thread isn't helping them and to be honest - likely isn't helping you - as your question won't appear on the main page. Posting a separate thread will bump your question to the top and possibly get more answers.

You have a point. But still, when someone find this post from google (like me) - it is good to have some information or updates or smnth.

... anyway. Will post new thread.

Threads aren't intended to be discussions around a topic - they're meant to help the original poster solve their problem. Posting a new question on a month old thread isn't helping them and to be honest - likely isn't helping you - as your question won't appear on the main page. Posting a separate thread will bump your question to the top and possibly get more answers.