I'm trying to use session variables in my custom service.
I already set add the following lines to services.yaml
MySession:
class: App\Services\SessionTest
arguments: ['@session', '@service_container']
And my SessionTest looks like this
namespace App\Services;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpFoundation\Request;
class SessionTest
{
public $session;
public function __construct()
{
}
public function index()
{
echo "<pre>";
var_dump($this->session);
echo "</pre>";
}
}
And receive this error: Too few arguments to function App\Services\SessionTest::__construct(), 0 passed in /var/www/app.dev/src/Controller/OrdersController.php on line 33 and exactly 1 expected