Update 02_Sessions.md

Add additional 'use' statement (for Injector) in example of getting a session outside a controller.
This commit is contained in:
DorsetDigital 2018-03-09 20:03:46 +00:00 committed by GitHub
parent fc457caa6e
commit 72c5d5244f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@ Otherwise, if you're not in a controller, get the request as a service.
```php
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Injector\Injector;
$request = Injector::inst()->get(HTTPRequest::class);
$session = $request->getSession();