|
11 | 11 |
|
12 | 12 | namespaceSymfony\Component\DependencyInjection\Loader\Configurator; |
13 | 13 |
|
14 | | -useSymfony\Bundle\FrameworkBundle\Session\DeprecatedSessionFactory; |
15 | | -useSymfony\Component\HttpFoundation\Session\Attribute\AttributeBag; |
16 | | -useSymfony\Component\HttpFoundation\Session\Flash\FlashBag; |
17 | | -useSymfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; |
18 | | -useSymfony\Component\HttpFoundation\Session\Session; |
19 | 14 | useSymfony\Component\HttpFoundation\Session\SessionFactory; |
20 | | -useSymfony\Component\HttpFoundation\Session\SessionInterface; |
21 | 15 | useSymfony\Component\HttpFoundation\Session\Storage\Handler\AbstractSessionHandler; |
22 | 16 | useSymfony\Component\HttpFoundation\Session\Storage\Handler\IdentityMarshaller; |
23 | 17 | useSymfony\Component\HttpFoundation\Session\Storage\Handler\MarshallingSessionHandler; |
24 | 18 | useSymfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; |
25 | 19 | useSymfony\Component\HttpFoundation\Session\Storage\Handler\SessionHandlerFactory; |
26 | 20 | useSymfony\Component\HttpFoundation\Session\Storage\Handler\StrictSessionHandler; |
27 | 21 | useSymfony\Component\HttpFoundation\Session\Storage\MetadataBag; |
28 | | -useSymfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; |
29 | 22 | useSymfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorageFactory; |
30 | | -useSymfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; |
31 | 23 | useSymfony\Component\HttpFoundation\Session\Storage\NativeSessionStorageFactory; |
32 | | -useSymfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage; |
33 | 24 | useSymfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorageFactory; |
34 | | -useSymfony\Component\HttpFoundation\Session\Storage\ServiceSessionFactory; |
35 | | -useSymfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; |
36 | 25 | useSymfony\Component\HttpKernel\EventListener\SessionListener; |
37 | 26 |
|
38 | 27 | returnstaticfunction (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) |
|
146 | 82 | ->set('session_listener', SessionListener::class) |
147 | 83 | ->args([ |
148 | 84 | service_locator([ |
149 | | -'session' =>service('.session.do-not-use')->ignoreOnInvalid(), |
150 | | -'initialized_session' =>service('.session.do-not-use')->ignoreOnUninitialized(), |
| 85 | +'session_factory' =>service('session.factory'), |
151 | 86 | 'logger' =>service('logger')->ignoreOnInvalid(), |
152 | 87 | 'session_collector' =>service('data_collector.request.session_collector')->ignoreOnInvalid(), |
153 | 88 | ]), |
154 | 89 | param('kernel.debug'), |
155 | 90 | ]) |
156 | 91 | ->tag('kernel.event_subscriber') |
157 | 92 |
|
158 | | -// for BC |
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.') |
161 | | - |
162 | 93 | ->set('session.marshaller', IdentityMarshaller::class) |
163 | 94 |
|
164 | 95 | ->set('session.marshalling_handler', MarshallingSessionHandler::class) |
|