Skip to content
This repository has been archived by the owner on Nov 21, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from dmaicher/test_solarium_6
Browse files Browse the repository at this point in the history
support solarium 6
  • Loading branch information
dmaicher authored Jun 22, 2020
2 parents 07c37e9 + fc155e0 commit b73fd4e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ matrix:
- php: 7.1
env:
- SYMFONY_REQUIRE="4.4.*"
- SOLARIUM_REQUIRE="^5.2"

- php: 7.4
env:
- SYMFONY_REQUIRE="5.1.*"

before_install:
- phpenv config-rm xdebug.ini || echo "xDebug not disabled"
- composer global require --no-progress --no-scripts --no-plugins symfony/flex

install:
- rm -rf composer.lock vendor/*
- if [[ ${SOLARIUM_REQUIRE} ]]; then composer req solarium/solarium $SOLARIUM_REQUIRE; fi
- composer update

script:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"require": {
"php": "^7.1",
"solarium/solarium": "^5.2",
"solarium/solarium": "^5.2 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.0"
},
"require-dev": {
Expand Down
7 changes: 5 additions & 2 deletions src/DataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Solarium\Core\Event\PostExecuteRequest as SolariumPostExecuteRequestEvent;
use Solarium\Core\Event\PreExecuteRequest as SolariumPreExecuteRequestEvent;
use Solarium\Core\Plugin\AbstractPlugin as SolariumPlugin;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request as HttpRequest;
use Symfony\Component\HttpFoundation\Response as HttpResponse;
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
Expand All @@ -35,8 +36,10 @@ protected function initPluginType(): void
{
$dispatcher = $this->client->getEventDispatcher();
if (!in_array($dispatcher, $this->eventDispatchers, true)) {
$dispatcher->addListener(SolariumEvents::PRE_EXECUTE_REQUEST, [$this, 'preExecuteRequest'], 1000);
$dispatcher->addListener(SolariumEvents::POST_EXECUTE_REQUEST, [$this, 'postExecuteRequest'], -1000);
if ($dispatcher instanceof EventDispatcherInterface) {
$dispatcher->addListener(SolariumEvents::PRE_EXECUTE_REQUEST, [$this, 'preExecuteRequest'], 1000);
$dispatcher->addListener(SolariumEvents::POST_EXECUTE_REQUEST, [$this, 'postExecuteRequest'], -1000);
}
$this->eventDispatchers[] = $dispatcher;
}
}
Expand Down

0 comments on commit b73fd4e

Please sign in to comment.