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

Commit

Permalink
Symfony 5 (#324)
Browse files Browse the repository at this point in the history
* remove 3.4 support, go to SF4/5
  • Loading branch information
gilles-g authored Dec 12, 2019
1 parent 92df063 commit 4f88c5a
Show file tree
Hide file tree
Showing 15 changed files with 197 additions and 171 deletions.
34 changes: 15 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
language: php

dist: trusty

cache:
directories:
- $HOME/.composer/cache/files

php:
- 7.0
- 7.1
- 7.2
- 7.3

env:
global:
- MONGO_EXTENSION="mongodb.so"
- COMPOSER_FLAGS=""

matrix:
include:
- php: 5.6
env: MONGO_EXTENSION="mongo.so" SYMFONY_VERSION="symfony/lts:^2"
- php: 7.1
env: SYMFONY_VERSION="symfony/lts:^3"
fast_finish: true
include:
- php: 7.3
env: SYMFONY_VERSION=4.3.*
- php: 7.3
env: SYMFONY_VERSION=4.4.*
- php: 7.3
env: SYMFONY_VERSION=5.0.*

services:
- mongodb
Expand All @@ -30,13 +28,11 @@ before_install:
- echo "extension = $MONGO_EXTENSION" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

before_script:
- composer config platform.ext-mongo 1.6.16
- if [ "$SYMFONY_VERSION" != "" ]; then travis_wait composer require --no-update $SYMFONY_VERSION; fi;
- travis_wait composer update --prefer-dist --no-interaction $COMPOSER_FLAGS
- if ! [[ $TRAVIS_PHP_VERSION =~ ^5 ]]; then composer require alcaeus/mongo-php-adapter; fi;
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- if ! [[ $TRAVIS_PHP_VERSION =~ ^5 ]]; then composer require alcaeus/mongo-php-adapter --no-update; fi;

install: composer update --no-interaction

script:
- composer validate --no-check-lock --strict
- bin/phpunit --coverage-text
script: composer test
2 changes: 1 addition & 1 deletion Event/ApplyFilterConditionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Lexik\Bundle\FormFilterBundle\Event;

use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionBuilderInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;

/**
* Event class to compute the WHERE clause from the conditions.
Expand Down
2 changes: 1 addition & 1 deletion Event/GetFilterConditionEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Lexik\Bundle\FormFilterBundle\Event;

use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
use Lexik\Bundle\FormFilterBundle\Filter\Condition\Condition;
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionInterface;
use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;
Expand Down
4 changes: 2 additions & 2 deletions Event/Listener/DoctrineMongoDBApplyFilterListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Lexik\Bundle\FormFilterBundle\Event\Listener;

use Doctrine\MongoDB\Query\Builder;
use Doctrine\MongoDB\Query\Expr;
use Doctrine\ODM\MongoDB\Query\Builder;
use Doctrine\ODM\MongoDB\Query\Expr;
use Lexik\Bundle\FormFilterBundle\Event\ApplyFilterConditionEvent;
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionInterface;
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionNodeInterface;
Expand Down
2 changes: 1 addition & 1 deletion Event/PrepareEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Lexik\Bundle\FormFilterBundle\Event;

use Symfony\Component\EventDispatcher\Event;
use Symfony\Contracts\EventDispatcher\Event;
use Lexik\Bundle\FormFilterBundle\Filter\Query\QueryInterface;

/**
Expand Down
11 changes: 7 additions & 4 deletions Filter/FilterBuilderUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionBuilder;
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionBuilderInterface;
use Lexik\Bundle\FormFilterBundle\Filter\Condition\ConditionInterface;
Expand Down Expand Up @@ -85,7 +85,8 @@ public function addFilterConditions(FormInterface $form, $queryBuilder, $alias =
{
// create the right QueryInterface object
$event = new PrepareEvent($queryBuilder);
$this->dispatcher->dispatch(FilterEvents::PREPARE, $event);

$this->dispatcher->dispatch($event, FilterEvents::PREPARE);

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

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

$this->dispatcher->dispatch(new ApplyFilterConditionEvent($queryBuilder, $this->conditionBuilder), $name);

$this->conditionBuilder = null;

Expand Down Expand Up @@ -207,7 +209,8 @@ protected function getFilterCondition(FormInterface $form, AbstractType $formTyp
}

$event = new GetFilterConditionEvent($filterQuery, $field, $values);
$this->dispatcher->dispatch($eventName, $event);

$this->dispatcher->dispatch($event, $eventName);

$condition = $event->getCondition();
}
Expand Down
2 changes: 1 addition & 1 deletion Filter/Form/FilterTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getExtendedType()
/**
* @return iterable
*/
public static function getExtendedTypes()
public static function getExtendedTypes(): iterable
{
return [FormType::class];
}
Expand Down
Loading

0 comments on commit 4f88c5a

Please sign in to comment.