From 48420e85a4f39f4ae8b5c7bc29943e7c6e450d12 Mon Sep 17 00:00:00 2001 From: Markus Kalkbrenner Date: Sat, 7 Sep 2019 09:30:24 +0200 Subject: [PATCH] BufferedAdd does not support Symfony event dispatcher fixes #697 --- CHANGELOG.md | 4 ++++ src/Plugin/BufferedAdd/BufferedAdd.php | 8 ++++---- src/Plugin/ParallelExecution/ParallelExecution.php | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a436e7ed..bab9fd3e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to the solarium library will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [5.1.2] +### Fixed +- BufferedAdd does not support Symfony event dispatcher + ## [5.1.1] ### Fixed - PHP 7.1 compatibility issue: date constants are not available as part of DateTimeInterface before PHP 7.2.0 diff --git a/src/Plugin/BufferedAdd/BufferedAdd.php b/src/Plugin/BufferedAdd/BufferedAdd.php index 2dc9e5e99..de247b082 100755 --- a/src/Plugin/BufferedAdd/BufferedAdd.php +++ b/src/Plugin/BufferedAdd/BufferedAdd.php @@ -234,14 +234,14 @@ public function flush(?bool $overwrite = null, ?int $commitWithin = null) $commitWithin = null === $commitWithin ? $this->getCommitWithin() : $commitWithin; $event = new PreFlushEvent($this->buffer, $overwrite, $commitWithin); - $this->client->getEventDispatcher()->dispatch(Events::PRE_FLUSH, $event); + $this->client->getEventDispatcher()->dispatch($event, Events::PRE_FLUSH); $this->updateQuery->addDocuments($event->getBuffer(), $event->getOverwrite(), $event->getCommitWithin()); $result = $this->client->update($this->updateQuery, $this->getEndpoint()); $this->clear(); $event = new PostFlushEvent($result); - $this->client->getEventDispatcher()->dispatch(Events::POST_FLUSH, $event); + $this->client->getEventDispatcher()->dispatch($event, Events::POST_FLUSH); return $result; } @@ -261,7 +261,7 @@ public function flush(?bool $overwrite = null, ?int $commitWithin = null) public function commit(?bool $overwrite = null, ?bool $softCommit = null, ?bool $waitSearcher = null, ?bool $expungeDeletes = null) { $event = new PreCommitEvent($this->buffer, $overwrite, $softCommit, $waitSearcher, $expungeDeletes); - $this->client->getEventDispatcher()->dispatch(Events::PRE_COMMIT, $event); + $this->client->getEventDispatcher()->dispatch($event, Events::PRE_COMMIT); $this->updateQuery->addDocuments($this->buffer, $event->getOverwrite()); $this->updateQuery->addCommit($event->getSoftCommit(), $event->getWaitSearcher(), $event->getExpungeDeletes()); @@ -269,7 +269,7 @@ public function commit(?bool $overwrite = null, ?bool $softCommit = null, ?bool $this->clear(); $event = new PostCommitEvent($result); - $this->client->getEventDispatcher()->dispatch(Events::POST_COMMIT, $event); + $this->client->getEventDispatcher()->dispatch($event, Events::POST_COMMIT); return $result; } diff --git a/src/Plugin/ParallelExecution/ParallelExecution.php b/src/Plugin/ParallelExecution/ParallelExecution.php index 445d47b3b..6b7de48a0 100755 --- a/src/Plugin/ParallelExecution/ParallelExecution.php +++ b/src/Plugin/ParallelExecution/ParallelExecution.php @@ -137,7 +137,7 @@ public function execute(): array } $event = new ExecuteEndEvent(); - $this->client->getEventDispatcher()->dispatch(Events::EXECUTE_END, $event); + $this->client->getEventDispatcher()->dispatch($event, Events::EXECUTE_END); // get the results $results = [];