Skip to content

Commit

Permalink
Merge pull request #20 from PUGX/fix-request
Browse files Browse the repository at this point in the history
🐛 use main request
  • Loading branch information
garak authored Dec 13, 2024
2 parents a24093a + be48c46 commit 43a934c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private function getForm(string $name, ?string $type = null): FormInterface

private function getRequest(): Request
{
return $this->requestStack->getCurrentRequest();
return $this->requestStack->getMainRequest();
}

private function getSession(): SessionInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/FilterRuntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __construct(private RequestStack $requestStack, private PFilter

public function has(string $name): bool
{
if (null === $request = $this->requestStack->getCurrentRequest()) {
if (null === $request = $this->requestStack->getMainRequest()) {
throw new \RuntimeException('No session found.');
}
$session = $request->getSession();
Expand Down

0 comments on commit 43a934c

Please sign in to comment.