Skip to content

Commit

Permalink
Remove the need for League Uri (#184)
Browse files Browse the repository at this point in the history
Remove the need for League Uri
  • Loading branch information
gisostallenberg authored Jul 15, 2020
1 parent c64de94 commit 90aba46
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 0 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
"doctrine/doctrine-bundle": "^1.8|^2.0",
"doctrine/orm": "^2.6",
"easycorp/easyadmin-bundle": "^2.2.2",
"league/uri-manipulations": "^1.3",
"league/uri-schemes": "^1.2",
"symfony/config": "^4.2|^5.0",
"symfony/dependency-injection": "^4.2|^5.0",
"symfony/event-dispatcher": "^4.2|^5.0",
Expand Down
10 changes: 4 additions & 6 deletions src/Controller/AdminExtensionControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use AlterPHP\EasyAdminExtensionBundle\Security\AdminAuthorizationChecker;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use League\Uri\Modifiers\RemoveQueryParams;
use League\Uri\Schemes\Http;
use Symfony\Component\HttpFoundation\JsonResponse;

trait AdminExtensionControllerTrait
Expand Down Expand Up @@ -34,12 +32,12 @@ function ($name) use ($hiddenFields) {
$baseMasterRequestUri = !$this->request->isXmlHttpRequest()
? $this->get('request_stack')->getMasterRequest()->getUri()
: $this->request->headers->get('referer');
$baseMasterRequestUri = Http::createFromString($baseMasterRequestUri);
$removeRefererModifier = new RemoveQueryParams(['referer']);
$masterRequestUri = $removeRefererModifier->process($baseMasterRequestUri);
\parse_str(\parse_url($baseMasterRequestUri, PHP_URL_QUERY), $queryParameters);
unset($queryParameters['referer']);
$masterRequestUri = \sprintf('%s?%s', \strtok($baseMasterRequestUri, '?'), \http_build_query($queryParameters));

$requestParameters = $this->request->query->all();
$requestParameters['referer'] = (string) $masterRequestUri;
$requestParameters['referer'] = $masterRequestUri;

$viewVars = [
'paginator' => $paginator,
Expand Down

0 comments on commit 90aba46

Please sign in to comment.