class ValidationErrorsMiddleware extends Middleware
{
public function __invoke($request, $response, $next)
{ this->container->view->getEnvironment()->addGlobal('errors', _SESSION[‘errors’]);
unset($_SESSION[‘errors’]);
But, getEnvironment and addGlobals are deprecated… so, I search in slim framework page but even it’s mentioned I don’t get how to use other options to make this work…
Message: Call to undefined method Slim\Views\Twig::environment()
or if I delete getEnvironment Message: Call to undefined method Slim\Views\Twig::addGlobal()
Do anyone could tell me what I need to use and where I can find information up today?
Yes, I’m using Slim 3, but as I saw it, those are Slim 2 methods and now deprecated, but don’t know how to jump from Slim2 to Slim 3 with same functionality but not deprecated methods.
can you provide entire error message and backtrace?
this is weird; your error message is about undefined method environment()
but the method name (and your code) should be method getEnvironment()