This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Bundle/FrameworkBundle
Fabien Potencier 43e32b86a2 feature #21164 [HttpKernel] Added the SessionValueResolver (iltar)
This PR was merged into the 3.3-dev branch.

Discussion
----------

[HttpKernel] Added the SessionValueResolver

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #21159
| License       | MIT
| Doc PR        | (soon)

This feature adds the `SessionValueResolver`. That means that you no longer have to rely on injecting a `SessionInterface` implementation via the constructor or getting this implementation from the `Request`. Regardless of method, it does not know about the `getFlashBag()`.

By adding the `Session` to the action arguments, you can now type-hint against the implementation rather than interface, which contains the `getFlashBag()`, making it accessible rather than using duck-typing.

_It should also feel less like injecting a service into the constructor which has a state or getting a service from the request._

**Old Situation**
```php
class Controller
{
    public function __construct(SessionInterface $session) { /* ... */ }

    public function fooAction(Request $request)
    {
        $this->get('session')->get(...);
        $request->getSession()->get(...);
        $this->session->get(...)

        // duck-typing
        $this->get('session')->getFlashBag();
        $request->getSession()->getFlashBag();
        $this->session->getFlashBag();

        $this->addFlash(...);
    }
}
```

**New Situation** _- The controller shortcut for flashbag could in theory be removed now_
```php
class Controller
{
    public function fooAction(Session $session)
    {
        $session->get(...);
        $session->getFlashBag();
    }
}
```

Commits
-------

b4464dcea1 Added the SessionValueResolver
2017-02-26 14:45:04 -08:00
..
CacheWarmer Merge branch '3.2' 2017-01-12 20:06:21 +01:00
Command feature #20632 [FrameworkBundle] Make use of stderr for non reliable output (chalasr, ogizanagi) 2017-02-19 14:38:27 -08:00
Console minor #21315 [DI][FrameworkBundle] Show autowired methods in descriptors (ogizanagi) 2017-02-16 05:25:28 -08:00
Controller Merge branch '3.1' into 3.2 2016-12-27 11:44:30 +01:00
DataCollector [FrameworkBundle] Extends the RequestDataCollector 2016-03-30 19:02:53 +02:00
DependencyInjection Merge branch '3.2' 2017-02-21 11:07:34 +01:00
EventListener [2.3] CS And DocBlock Fixes 2014-12-22 16:58:09 +01:00
HttpCache Silence invasive deprecation warnings, opt-in for warnings 2015-06-08 10:37:21 +01:00
Kernel added a micro kernel 2015-11-04 18:19:57 +01:00
Resources Added the SessionValueResolver 2017-02-22 09:50:54 +01:00
Routing [FrameworkBundle] Forbid env parameters in routing configuration 2016-11-29 18:09:44 +01:00
Templating Merge branch '3.2' 2017-02-16 14:50:29 -08:00
Test Merge branch '2.7' into 2.8 2017-02-18 18:06:33 +01:00
Tests Merge branch '3.2' 2017-02-24 05:59:04 -08:00
Translation Merge branch '2.8' into 3.2 2017-02-06 13:04:21 +01:00
Validator added friendly exception when constraint validator does not exist or it is not enabled 2016-08-24 03:54:03 -07:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md fixed CS 2017-02-16 05:35:07 -08:00
Client.php Merge branch '2.3' into 2.7 2016-03-16 17:00:15 +01:00
composer.json Merge branch '2.8' into 3.2 2017-02-21 15:41:00 +01:00
FrameworkBundle.php Merge branch '3.2' 2017-02-18 18:35:19 +01:00
LICENSE updated LICENSE year 2017-01-02 12:30:00 -08:00
phpunit.xml.dist [Cache] Add DSN, createClient & better error reporting to MemcachedAdapter 2017-01-02 17:22:30 +01:00
README.md add readme files where missing 2016-03-07 11:36:15 +01:00