Skip to content

Commit 38ffdfc

Browse files
committed
Store sessions in MongoDB
1 parent ae9ca57 commit 38ffdfc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

config/packages/framework.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ framework:
88
# Enables session support. Note that the session will ONLY be started if you read or write from it.
99
# Remove or comment this section to explicitly disable session support.
1010
session:
11-
handler_id: null
11+
handler_id: session.handler.mongodb
1212
cookie_secure: auto
1313
cookie_samesite: lax
1414
storage_factory_id: session.storage.factory.native
@@ -33,3 +33,12 @@ when@test:
3333
test: true
3434
session:
3535
storage_factory_id: session.storage.factory.mock_file
36+
37+
services:
38+
session.handler.mongodb:
39+
class: Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler
40+
arguments:
41+
$mongo: '@doctrine_mongodb.odm.default_connection'
42+
$options:
43+
database: '%env(MONGODB_DB)%'
44+
collection: 'sessions'

0 commit comments

Comments
 (0)