@@ 7-17 (lines=11) @@ | ||
4 | ||
5 | use App\Middleware\Middleware; |
|
6 | ||
7 | class OldInputMiddleware extends Middleware |
|
8 | { |
|
9 | public function __invoke($request, $response, $next) |
|
10 | { |
|
11 | $this->container->view->getEnvironment()->addGlobal('old', $_SESSION['old']); |
|
12 | $_SESSION['old'] = $request->getParams(); |
|
13 | ||
14 | $response = $next($request, $response); |
|
15 | return $response; |
|
16 | } |
|
17 | } |
|
18 |
@@ 7-20 (lines=14) @@ | ||
4 | ||
5 | use App\Middleware\Middleware; |
|
6 | ||
7 | class ValidationErrorsMiddleware extends Middleware |
|
8 | { |
|
9 | public function __invoke($request, $response, $next) |
|
10 | { |
|
11 | if (isset($_SESSION['errors'])) { |
|
12 | $this->container->view->getEnvironment()->addGlobal('errors', $_SESSION['errors']); |
|
13 | unset($_SESSION['errors']); |
|
14 | } |
|
15 | ||
16 | $response = $next($request, $response); |
|
17 | return $response; |
|
18 | } |
|
19 | } |
|
20 |