|
16 | 16 | use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
|
17 | 17 | use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
18 | 18 | use Symfony\Component\HttpFoundation\Session\Session;
|
| 19 | +use Symfony\Component\HttpFoundation\Session\SessionFactory; |
19 | 20 | use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
20 | 21 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler;
|
21 | 22 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\IdentityMarshaller;
|
|
25 | 26 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler;
|
26 | 27 | use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
|
27 | 28 | use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage;
|
| 29 | +use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorageFactory; |
28 | 30 | use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
|
| 31 | +use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorageFactory; |
29 | 32 | use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage;
|
| 33 | +use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorageFactory; |
| 34 | +use Symfony\Component\HttpFoundation\Session\Storage\ServiceSessionFactory; |
30 | 35 | use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface;
|
31 | 36 | use Symfony\Component\HttpKernel\EventListener\SessionListener;
|
32 | 37 |
|
|
35 | 40 |
|
36 | 41 | $container->services()
|
37 | 42 | ->set('.session.do-not-use', Session::class) // to be removed in 6.0
|
| 43 | + ->factory([service('session.factory'), 'createSession']) |
| 44 | + ->set('session.factory', SessionFactory::class) |
38 | 45 | ->args([
|
39 |
| - service('session.storage'), |
40 |
| - null, // AttributeBagInterface |
41 |
| - null, // FlashBagInterface |
| 46 | + service('request_stack'), |
| 47 | + service('session.storage.factory'), |
42 | 48 | [service('session_listener'), 'onSessionUsage'],
|
43 | 49 | ])
|
| 50 | + |
| 51 | + ->set('session.storage.factory.native', NativeSessionStorageFactory::class) |
| 52 | + ->args([ |
| 53 | + param('session.storage.options'), |
| 54 | + service('session.handler'), |
| 55 | + inline_service(MetadataBag::class) |
| 56 | + ->args([ |
| 57 | + param('session.metadata.storage_key'), |
| 58 | + param('session.metadata.update_threshold'), |
| 59 | + ]), |
| 60 | + false, |
| 61 | + ]) |
| 62 | + ->set('session.storage.factory.php_bridge', PhpBridgeSessionStorageFactory::class) |
| 63 | + ->args([ |
| 64 | + service('session.handler'), |
| 65 | + inline_service(MetadataBag::class) |
| 66 | + ->args([ |
| 67 | + param('session.metadata.storage_key'), |
| 68 | + param('session.metadata.update_threshold'), |
| 69 | + ]), |
| 70 | + false, |
| 71 | + ]) |
| 72 | + ->set('session.storage.factory.mock_file', MockFileSessionStorageFactory::class) |
| 73 | + ->args([ |
| 74 | + param('kernel.cache_dir').'/sessions', |
| 75 | + 'MOCKSESSID', |
| 76 | + inline_service(MetadataBag::class) |
| 77 | + ->args([ |
| 78 | + param('session.metadata.storage_key'), |
| 79 | + param('session.metadata.update_threshold'), |
| 80 | + ]), |
| 81 | + ]) |
| 82 | + ->set('session.storage.factory.service', ServiceSessionFactory::class) |
| 83 | + ->args([ |
| 84 | + service('session.storage'), |
| 85 | + ]) |
| 86 | + ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, use "session.storage.factory.native", "session.storage.factory.php_bridge" or "session.storage.factory.mock_file" instead.') |
| 87 | + |
44 | 88 | ->set('.session.deprecated', SessionInterface::class) // to be removed in 6.0
|
45 | 89 | ->factory([inline_service(DeprecatedSessionFactory::class)->args([service('request_stack')]), 'getSession'])
|
46 | 90 | ->alias(SessionInterface::class, '.session.do-not-use')
|
47 | 91 | ->deprecate('symfony/framework-bundle', '5.3', 'The "%alias_id%" alias is deprecated, use "$requestStack->getSession()" instead.')
|
48 | 92 | ->alias(SessionStorageInterface::class, 'session.storage')
|
| 93 | + ->deprecate('symfony/framework-bundle', '5.3', 'The "%alias_id%" alias is deprecated, use "session.storage.factory" instead.') |
49 | 94 | ->alias(\SessionHandlerInterface::class, 'session.handler')
|
50 | 95 |
|
51 | 96 | ->set('session.storage.metadata_bag', MetadataBag::class)
|
52 | 97 | ->args([
|
53 | 98 | param('session.metadata.storage_key'),
|
54 | 99 | param('session.metadata.update_threshold'),
|
55 | 100 | ])
|
| 101 | + ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, create your own "session.storage.factory" instead.') |
56 | 102 |
|
57 | 103 | ->set('session.storage.native', NativeSessionStorage::class)
|
58 | 104 | ->args([
|
59 | 105 | param('session.storage.options'),
|
60 | 106 | service('session.handler'),
|
61 | 107 | service('session.storage.metadata_bag'),
|
62 | 108 | ])
|
| 109 | + ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, use "session.storage.factory.native" instead.') |
63 | 110 |
|
64 | 111 | ->set('session.storage.php_bridge', PhpBridgeSessionStorage::class)
|
65 | 112 | ->args([
|
66 | 113 | service('session.handler'),
|
67 | 114 | service('session.storage.metadata_bag'),
|
68 | 115 | ])
|
| 116 | + ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, use "session.storage.factory.php_bridge" instead.') |
69 | 117 |
|
70 | 118 | ->set('session.flash_bag', FlashBag::class)
|
71 | 119 | ->factory([service('.session.do-not-use'), 'getFlashBag'])
|
|
83 | 131 | 'MOCKSESSID',
|
84 | 132 | service('session.storage.metadata_bag'),
|
85 | 133 | ])
|
| 134 | + ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, use "session.storage.factory.mock_file" instead.') |
86 | 135 |
|
87 | 136 | ->set('session.handler.native_file', StrictSessionHandler::class)
|
88 | 137 | ->args([
|
|
108 | 157 |
|
109 | 158 | // for BC
|
110 | 159 | ->alias('session.storage.filesystem', 'session.storage.mock_file')
|
| 160 | + ->deprecate('symfony/framework-bundle', '5.3', 'The "%alias_id%" alias is deprecated, use "session.storage.factory.mock_file" instead.') |
111 | 161 |
|
112 | 162 | ->set('session.marshaller', IdentityMarshaller::class)
|
113 | 163 |
|
|
0 commit comments