diff --git a/composer.json b/composer.json index 5fa3415..de5306b 100644 --- a/composer.json +++ b/composer.json @@ -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" } } diff --git a/src/DependencyInjection/OnRequestDependencyInjector.php b/src/DependencyInjection/OnRequestDependencyInjector.php index 910fb23..534757f 100644 --- a/src/DependencyInjection/OnRequestDependencyInjector.php +++ b/src/DependencyInjection/OnRequestDependencyInjector.php @@ -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; @@ -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 diff --git a/tests/DependencyInjection/OnRequestDependencyInjectorTest.php b/tests/DependencyInjection/OnRequestDependencyInjectorTest.php index 0aacba7..7c5eee7 100644 --- a/tests/DependencyInjection/OnRequestDependencyInjectorTest.php +++ b/tests/DependencyInjection/OnRequestDependencyInjectorTest.php @@ -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; @@ -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)); @@ -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 */ diff --git a/tests/Filter/VisibilityColumnConsideringSQLFilterTest.php b/tests/Filter/VisibilityColumnConsideringSQLFilterTest.php index 35ae6a9..621c29b 100644 --- a/tests/Filter/VisibilityColumnConsideringSQLFilterTest.php +++ b/tests/Filter/VisibilityColumnConsideringSQLFilterTest.php @@ -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; @@ -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); }