Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created new FlashBagProvider for accessing flash message bag
- FlashBagProvider is not wired in contructor anymore because it had side effects (session was started when the container was built) - see symfony/symfony#36063
- Loading branch information
1 parent
a13d385
commit 27b198d
Showing
3 changed files
with
50 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/framework/src/Component/FlashMessage/FlashBagProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shopsys\FrameworkBundle\Component\FlashMessage; | ||
|
||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; | ||
use Symfony\Component\HttpFoundation\Session\Session; | ||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | ||
|
||
class FlashBagProvider | ||
{ | ||
/** | ||
* @var \Symfony\Component\HttpFoundation\Session\Session | ||
*/ | ||
protected Session $session; | ||
|
||
/** | ||
* @param \Symfony\Component\HttpFoundation\Session\Session $session | ||
*/ | ||
public function __construct(SessionInterface $session) | ||
{ | ||
$this->session = $session; | ||
} | ||
|
||
/** | ||
* @return \Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface | ||
*/ | ||
public function getFlashBag(): FlashBagInterface | ||
{ | ||
return $this->session->getFlashBag(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters