|
11 | 11 |
|
12 | 12 | namespace Symfony\Component\DependencyInjection\Loader\Configurator; |
13 | 13 |
|
14 | | -use Symfony\Bundle\FrameworkBundle\Session\DeprecatedSessionFactory; |
15 | | -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; |
16 | | -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; |
17 | | -use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; |
18 | | -use Symfony\Component\HttpFoundation\Session\Session; |
19 | 14 | use Symfony\Component\HttpFoundation\Session\SessionFactory; |
20 | | -use Symfony\Component\HttpFoundation\Session\SessionInterface; |
21 | 15 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler; |
22 | 16 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\IdentityMarshaller; |
23 | 17 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\MarshallingSessionHandler; |
24 | 18 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; |
25 | 19 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\SessionHandlerFactory; |
26 | 20 | use Symfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler; |
27 | 21 | use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; |
28 | | -use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; |
29 | 22 | use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorageFactory; |
30 | | -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; |
31 | 23 | use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorageFactory; |
32 | | -use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage; |
33 | 24 | use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorageFactory; |
34 | | -use Symfony\Component\HttpFoundation\Session\Storage\ServiceSessionFactory; |
35 | | -use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; |
36 | 25 | use Symfony\Component\HttpKernel\EventListener\SessionListener; |
37 | 26 |
|
38 | 27 | return static function (ContainerConfigurator $container) { |
39 | 28 | $container->parameters()->set('session.metadata.storage_key', '_sf2_meta'); |
40 | 29 |
|
41 | 30 | $container->services() |
42 | | - ->set('.session.do-not-use', Session::class) // to be removed in 6.0 |
43 | | - ->factory([service('session.factory'), 'createSession']) |
44 | 31 | ->set('session.factory', SessionFactory::class) |
45 | 32 | ->args([ |
46 | 33 | service('request_stack'), |
|
79 | 66 | param('session.metadata.update_threshold'), |
80 | 67 | ]), |
81 | 68 | ]) |
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 | 69 |
|
88 | | - ->set('.session.deprecated', SessionInterface::class) // to be removed in 6.0 |
89 | | - ->factory([inline_service(DeprecatedSessionFactory::class)->args([service('request_stack')]), 'getSession']) |
90 | | - ->alias(SessionInterface::class, '.session.do-not-use') |
91 | | - ->deprecate('symfony/framework-bundle', '5.3', 'The "%alias_id%" and "SessionInterface" aliases are deprecated, use "$requestStack->getSession()" instead.') |
92 | | - ->alias(SessionStorageInterface::class, 'session.storage') |
93 | | - ->deprecate('symfony/framework-bundle', '5.3', 'The "%alias_id%" alias is deprecated, use "session.storage.factory" instead.') |
94 | 70 | ->alias(\SessionHandlerInterface::class, 'session.handler') |
95 | 71 |
|
96 | | - ->set('session.storage.metadata_bag', MetadataBag::class) |
97 | | - ->args([ |
98 | | - param('session.metadata.storage_key'), |
99 | | - param('session.metadata.update_threshold'), |
100 | | - ]) |
101 | | - ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, create your own "session.storage.factory" instead.') |
102 | | - |
103 | | - ->set('session.storage.native', NativeSessionStorage::class) |
104 | | - ->args([ |
105 | | - param('session.storage.options'), |
106 | | - service('session.handler'), |
107 | | - service('session.storage.metadata_bag'), |
108 | | - ]) |
109 | | - ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, use "session.storage.factory.native" instead.') |
110 | | - |
111 | | - ->set('session.storage.php_bridge', PhpBridgeSessionStorage::class) |
112 | | - ->args([ |
113 | | - service('session.handler'), |
114 | | - service('session.storage.metadata_bag'), |
115 | | - ]) |
116 | | - ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, use "session.storage.factory.php_bridge" instead.') |
117 | | - |
118 | | - ->set('session.flash_bag', FlashBag::class) |
119 | | - ->factory([service('.session.do-not-use'), 'getFlashBag']) |
120 | | - ->deprecate('symfony/framework-bundle', '5.1', 'The "%service_id%" service is deprecated, use "$session->getFlashBag()" instead.') |
121 | | - ->alias(FlashBagInterface::class, 'session.flash_bag') |
122 | | - |
123 | | - ->set('session.attribute_bag', AttributeBag::class) |
124 | | - ->factory([service('.session.do-not-use'), 'getBag']) |
125 | | - ->args(['attributes']) |
126 | | - ->deprecate('symfony/framework-bundle', '5.1', 'The "%service_id%" service is deprecated, use "$session->getAttributeBag()" instead.') |
127 | | - |
128 | | - ->set('session.storage.mock_file', MockFileSessionStorage::class) |
129 | | - ->args([ |
130 | | - param('kernel.cache_dir').'/sessions', |
131 | | - 'MOCKSESSID', |
132 | | - service('session.storage.metadata_bag'), |
133 | | - ]) |
134 | | - ->deprecate('symfony/framework-bundle', '5.3', 'The "%service_id%" service is deprecated, use "session.storage.factory.mock_file" instead.') |
135 | | - |
136 | 72 | ->set('session.handler.native_file', StrictSessionHandler::class) |
137 | 73 | ->args([ |
138 | 74 | inline_service(NativeFileSessionHandler::class) |
|
147 | 83 | ->args([ |
148 | 84 | service_locator([ |
149 | 85 | 'session_factory' => service('session.factory')->ignoreOnInvalid(), |
150 | | - 'session' => service('.session.do-not-use')->ignoreOnInvalid(), |
151 | | - 'initialized_session' => service('.session.do-not-use')->ignoreOnUninitialized(), |
152 | 86 | 'logger' => service('logger')->ignoreOnInvalid(), |
153 | 87 | 'session_collector' => service('data_collector.request.session_collector')->ignoreOnInvalid(), |
154 | 88 | ]), |
155 | 89 | param('kernel.debug'), |
156 | 90 | ]) |
157 | 91 | ->tag('kernel.event_subscriber') |
158 | 92 |
|
159 | | - // for BC |
160 | | - ->alias('session.storage.filesystem', 'session.storage.mock_file') |
161 | | - ->deprecate('symfony/framework-bundle', '5.3', 'The "%alias_id%" alias is deprecated, use "session.storage.factory.mock_file" instead.') |
162 | | - |
163 | 93 | ->set('session.marshaller', IdentityMarshaller::class) |
164 | 94 |
|
165 | 95 | ->set('session.marshalling_handler', MarshallingSessionHandler::class) |
|
0 commit comments