Skip to content

Commit

Permalink
Allow Symfony 5.4; drop support for Symfony 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
relthyg committed Jan 24, 2023
2 parents 137f4c6 + 839abae commit 96525b6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
17 changes: 7 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,18 @@
"doctrine/annotations": "^1.12",
"doctrine/doctrine-bundle": "^1.12.13|^2.0",
"doctrine/orm": "^2.7.2",
"symfony/config": "^4.4",
"symfony/dependency-injection": "^3.4|^4.4",
"symfony/event-dispatcher": "^3.4|^4.4",
"symfony/http-kernel": "^3.4|^4.4"
"symfony/config": "^4.4|^5.4",
"symfony/dependency-injection": "^4.4|^5.4",
"symfony/event-dispatcher": "^4.4|^5.4",
"symfony/http-kernel": "^4.4|^5.4"
},
"config": {
"sort-packages": true,
"platform": {
"php": "7.2.24"
}
"sort-packages": true
},
"require-dev": {
"dama/doctrine-test-bundle": "^6.5",
"phpunit/phpunit": "^8.5",
"symfony/framework-bundle": "^4.4",
"symfony/yaml": "^3.4"
"symfony/framework-bundle": "^4.4|^5.4",
"symfony/yaml": "^4.4|^5.4"
}
}
4 changes: 2 additions & 2 deletions src/DependencyInjection/OnRequestDependencyInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Doctrine\ORM\EntityManagerInterface;
use RuntimeException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Webfactory\VisibilityFilterBundle\Filter\Strategy\FilterStrategy;
use Webfactory\VisibilityFilterBundle\Filter\VisibilityColumnConsideringSQLFilter;
Expand Down Expand Up @@ -45,7 +45,7 @@ public static function getSubscribedEvents()
return [KernelEvents::REQUEST => 'setUpFilter'];
}

public function setUpFilter(GetResponseEvent $event): void
public function setUpFilter(RequestEvent $event): void
{
if (!$event->isMasterRequest()) {
return; // filter only needs to be set up once (in the master request), as all sub request share the filter instance with the master request
Expand Down
6 changes: 3 additions & 3 deletions tests/DependencyInjection/OnRequestDependencyInjectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Webfactory\VisibilityFilterBundle\Filter\VisibilityColumnConsideringSQLFilter;
Expand Down Expand Up @@ -46,8 +47,7 @@ public function setUp(): void
*/
public function enables_filter_on_request(): void
{
// we use the deprecated GetResponseEvent in order to support Symfony 3.4 - this can be changed to RequestEvent when removing 3.4 support
$masterRequestEvent = new GetResponseEvent(static::$kernel, new Request(), HttpKernelInterface::MASTER_REQUEST);
$masterRequestEvent = new RequestEvent(static::$kernel, new Request(), HttpKernelInterface::MASTER_REQUEST);
$this->eventDispatcher->dispatch($masterRequestEvent, KernelEvents::REQUEST);

static::assertTrue($this->entityManager->getFilters()->isEnabled(VisibilityColumnConsideringSQLFilter::NAME));
Expand All @@ -60,7 +60,7 @@ public function injects_dependencies_into_filter(): void
{
$this->entityManager->getConfiguration()->addFilter(VisibilityColumnConsideringSQLFilter::NAME, VisibilityColumnConsideringSQLFilterMock::class);

$masterRequestEvent = new GetResponseEvent(static::$kernel, new Request(), HttpKernelInterface::MASTER_REQUEST);
$masterRequestEvent = new RequestEvent(static::$kernel, new Request(), HttpKernelInterface::MASTER_REQUEST);
$this->eventDispatcher->dispatch($masterRequestEvent, KernelEvents::REQUEST);

/** @var VisibilityColumnConsideringSQLFilterMock $filterMock */
Expand Down
4 changes: 2 additions & 2 deletions tests/Filter/VisibilityColumnConsideringSQLFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Webfactory\VisibilityFilterBundle\Tests\Fixtures\EntityWithManyToManyRelationship;
Expand Down Expand Up @@ -43,7 +43,7 @@ protected function setUp(): void

// activate filter by simulating a request
$eventDispatcher = static::$container->get(EventDispatcherInterface::class);
$masterRequestEvent = new GetResponseEvent(static::$kernel, new Request(), HttpKernelInterface::MASTER_REQUEST);
$masterRequestEvent = new RequestEvent(static::$kernel, new Request(), HttpKernelInterface::MASTER_REQUEST);
$eventDispatcher->dispatch($masterRequestEvent, KernelEvents::REQUEST);
}

Expand Down

0 comments on commit 96525b6

Please # to comment.