Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-adding , '@session.flash_bag' #15184

Closed
wants to merge 1 commit into from

Conversation

ThomasLandauer
Copy link
Contributor

It was there in 4.4: https://symfony.com/doc/4.4/session.html#basic-usage
But when I omit it, I'm getting (Symfony 5.2):

Circular reference detected for service "session", path: "session -> session.flash_bag -> session".

TODO: PHP config is missing for this code block. I'm doing it like this - should I make a PR? (But I don't know the XML way)

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag;
use Symfony\Component\HttpFoundation\Session\Session;

$services->set('session', Session::class)->public()->args([service('session.storage'), service('session.namespacedattributebag')]);
$services->set('session.namespacedattributebag', NamespacedAttributeBag::class);

It was there in 4.4: https://symfony.com/doc/4.4/session.html#basic-usage
But when I omit it, I'm getting (Symfony 5.2):
> Circular reference detected for service "session", path: "session -> session.flash_bag -> session".

TODO: PHP config is missing for this code block. I'm doing it like this - should I make a PR? (But I don't know the XML way)
```php
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag;
use Symfony\Component\HttpFoundation\Session\Session;

$services->set('session', Session::class)->public()->args([service('session.storage'), service('session.namespacedattributebag')]);
$services->set('session.namespacedattributebag', NamespacedAttributeBag::class);
```
@ThomasLandauer
Copy link
Contributor Author

Actually, I'm not sure anymore about this. When passing session.flash_bag, I'm getting:

User Deprecated: Since symfony/framework-bundle 5.1: The "session.flash_bag" service is deprecated, use "$session->getFlashBag()" instead.

But when not passing it, I'm getting the circular reference exception (see above), which should have been fixed by symfony/symfony#36261

So what's the status now?

@wouterj
Copy link
Member

wouterj commented Sep 4, 2022

I'm closing here, it seems like another contribution was merged that re-added the @session.flash_bag service. And the feature itself was deprecated in 5.x and removed in 6.0 (ref symfony/symfony#32616 ), given its bad DX and small use-case.

@wouterj wouterj closed this Sep 4, 2022
@ThomasLandauer ThomasLandauer deleted the patch-10 branch September 4, 2022 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants