8000 Do not extend @final SessionListener internally · symfony/symfony@cf61102 · GitHub
[go: up one dir, main page]

Skip to content

Commit cf61102

Browse files
committed
Do not extend @Final SessionListener internally
1 parent 8701cae commit cf61102

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,33 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\EventListener;
1313

14-
use Symfony\Component\HttpKernel\EventListener\SessionListener as BaseSessionListener;
14+
use Symfony\Component\DependencyInjection\ContainerInterface;
15+
use Symfony\Component\HttpKernel\EventListener\AbstractSessionListener;
1516

16-
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use %s instead.', SessionListener::class, BaseSessionListener::class), E_USER_DEPRECATED);
17+
@trigger_error(sprintf('The %s class is deprecated since version 3.3 and will be removed in 4.0. Use Symfony\Component\HttpKernel\EventListener\SessionListener instead.', SessionListener::class), E_USER_DEPRECATED);
1718

1819
/**
1920
* Sets the session in the request.
2021
*
2122
* @author Fabien Potencier <fabien@symfony.com>
2223
*
23-
* @deprecated since version 3.3, to be removed in 4.0. Use {@link BaseSessionListener} instead
24+
* @deprecated since version 3.3, to be removed in 4.0. Use Symfony\Component\HttpKernel\EventListener\SessionListener instead
2425
*/
25-
class SessionListener extends BaseSessionListener
26+
class SessionListener extends AbstractSessionListener
2627
{
28+
private $container;
29+
30+
public function __construct(ContainerInterface $container)
31+
{
32+
$this->container = $container;
33+
}
34+
35+
protected function getSession()
36+
{
37+
if (!$this->container->has('session')) {
38+
return;
39+
}
40+
41+
return $this->container->get('session');
42+
}
2743
}

0 commit comments

Comments
 (0)
0