Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit 4f88c5a

Browse files
authored
Symfony 5 (#324)
* remove 3.4 support, go to SF4/5
1 parent 92df063 commit 4f88c5a

15 files changed

+197
-171
lines changed

.travis.yml

+15-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
language: php
22

3+
dist: trusty
4+
35
cache:
46
directories:
57
- $HOME/.composer/cache/files
68

7-
php:
8-
- 7.0
9-
- 7.1
10-
- 7.2
11-
- 7.3
12-
139
env:
1410
global:
1511
- MONGO_EXTENSION="mongodb.so"
1612
- COMPOSER_FLAGS=""
1713

1814
matrix:
19-
include:
20-
- php: 5.6
21-
env: MONGO_EXTENSION="mongo.so" SYMFONY_VERSION="symfony/lts:^2"
22-
- php: 7.1
23-
env: SYMFONY_VERSION="symfony/lts:^3"
2415
fast_finish: true
16+
include:
17+
- php: 7.3
18+
env: SYMFONY_VERSION=4.3.*
19+
- php: 7.3
20+
env: SYMFONY_VERSION=4.4.*
21+
- php: 7.3
22+
env: SYMFONY_VERSION=5.0.*
2523

2624
services:
2725
- mongodb
@@ -30,13 +28,11 @@ before_install:
3028
- echo "extension = $MONGO_EXTENSION" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
3129
- echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
3230
- echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
33-
34-
before_script:
3531
- composer config platform.ext-mongo 1.6.16
36-
- if [ "$SYMFONY_VERSION" != "" ]; then travis_wait composer require --no-update $SYMFONY_VERSION; fi;
37-
- travis_wait composer update --prefer-dist --no-interaction $COMPOSER_FLAGS
38-
- if ! [[ $TRAVIS_PHP_VERSION =~ ^5 ]]; then composer require alcaeus/mongo-php-adapter; fi;
32+
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
33+
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
34+
- if ! [[ $TRAVIS_PHP_VERSION =~ ^5 ]]; then composer require alcaeus/mongo-php-adapter --no-update; fi;
35+
36+
install: composer update --no-interaction
3937

40-
script:
41-
- composer validate --no-check-lock --strict
42-
- bin/phpunit --coverage-text
38+
script: composer test

Event/ApplyFilterConditionEvent.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Lexik\Bundle\FormFilterBundle\Event;
44

55
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionBuilderInterface;
6-
use Symfony\Component\EventDispatcher\Event;
6+
use Symfony\Contracts\EventDispatcher\Event;
77

88
/**
99
* Event class to compute the WHERE clause from the conditions.

Event/GetFilterConditionEvent.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Lexik\Bundle\FormFilterBundle\Event;
44

5-
use Symfony\Component\EventDispatcher\Event;
5+
use Symfony\Contracts\EventDispatcher\Event;
66
use Lexik\Bundle\FormFilterBundle\Filter\Condition\Condition;
77
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionInterface;
88
use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;

Event/Listener/DoctrineMongoDBApplyFilterListener.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Lexik\Bundle\FormFilterBundle\Event\Listener;
44

5-
use Doctrine\MongoDB\Query\Builder;
6-
use Doctrine\MongoDB\Query\Expr;
5+
use Doctrine\ODM\MongoDB\Query\Builder;
6+
use Doctrine\ODM\MongoDB\Query\Expr;
77
use Lexik\Bundle\FormFilterBundle\Event\ApplyFilterConditionEvent;
88
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionInterface;
99
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionNodeInterface;

Event/PrepareEvent.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Lexik\Bundle\FormFilterBundle\Event;
44

5-
use Symfony\Component\EventDispatcher\Event;
5+
use Symfony\Contracts\EventDispatcher\Event;
66
use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
77

88
/**

Filter/FilterBuilderUpdater.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Symfony\Component\Form\AbstractType;
66
use Symfony\Component\Form\Form;
77
use Symfony\Component\Form\FormInterface;
8-
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
8+
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
99
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionBuilder;
1010
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionBuilderInterface;
1111
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionInterface;
@@ -85,7 +85,8 @@ public function addFilterConditions(FormInterface $form, $queryBuilder, $alias =
8585
{
8686
// create the right QueryInterface object
8787
$event = new PrepareEvent($queryBuilder);
88-
$this->dispatcher->dispatch(FilterEvents::PREPARE, $event);
88+
89+
$this->dispatcher->dispatch($event, FilterEvents::PREPARE);
8990

9091
if (!$event->getFilterQuery() instanceof QueryInterface) {
9192
throw new \RuntimeException("Couldn't find any filter query object.");
@@ -103,7 +104,8 @@ public function addFilterConditions(FormInterface $form, $queryBuilder, $alias =
103104

104105
// walk condition nodes to add condition on the query builder instance
105106
$name = sprintf('lexik_filter.apply_filters.%s', $event->getFilterQuery()->getEventPartName());
106-
$this->dispatcher->dispatch($name, new ApplyFilterConditionEvent($queryBuilder, $this->conditionBuilder));
107+
108+
$this->dispatcher->dispatch(new ApplyFilterConditionEvent($queryBuilder, $this->conditionBuilder), $name);
107109

108110
$this->conditionBuilder = null;
109111

@@ -207,7 +209,8 @@ protected function getFilterCondition(FormInterface $form, AbstractType $formTyp
207209
}
208210

209211
$event = new GetFilterConditionEvent($filterQuery, $field, $values);
210-
$this->dispatcher->dispatch($eventName, $event);
212+
213+
$this->dispatcher->dispatch($event, $eventName);
211214

212215
$condition = $event->getCondition();
213216
}

Filter/Form/FilterTypeExtension.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getExtendedType()
5151
/**
5252
* @return iterable
5353
*/
54-
public static function getExtendedTypes()
54+
public static function getExtendedTypes(): iterable
5555
{
5656
return [FormType::class];
5757
}

0 commit comments

Comments
 (0)