The following code saved sessions to MongoDB in Symfony 2.2, but now (looks like starting with version 2.3) doesn't work - sessions are stored in filesystem.
In other words - if I downgrade to Symfony HttpFoundation 2.2 - everything works, when I go to 2.3 - it breaks.
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler;
// ...
$sessionHandler = new MongoDbSessionHandler(
new \MongoClient("mongodb://localhost:27017"), [
"database" => "MyDatabase",
"collection" => "sessions"
]
);
session_set_save_handler(
array($sessionHandler, "open"),
array($sessionHandler, "close"),
array($sessionHandler, "read"),
array($sessionHandler, "write"),
array($sessionHandler, "destroy"),
array($sessionHandler, "gc")
);
// ...
$session = new Session();
$session->set('something', 'abc');
Note that session is NOT started by legacy php code elsewhere.
The following code saved sessions to MongoDB in Symfony 2.2, but now (looks like starting with version 2.3) doesn't work - sessions are stored in filesystem.
In other words - if I downgrade to Symfony HttpFoundation 2.2 - everything works, when I go to 2.3 - it breaks.
Note that session is NOT started by legacy php code elsewhere.