Skip to content

Commit

Permalink
BufferedAdd does not support Symfony event dispatcher
Browse files Browse the repository at this point in the history
fixes #697
  • Loading branch information
Markus Kalkbrenner committed Sep 7, 2019
1 parent 7886cef commit 48420e8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Plugin/BufferedAdd/BufferedAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -261,15 +261,15 @@ 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());
$result = $this->client->update($this->updateQuery, $this->getEndpoint());
$this->clear();

$event = new PostCommitEvent($result);
$this->client->getEventDispatcher()->dispatch(Events::POST_COMMIT, $event);
$this->client->getEventDispatcher()->dispatch($event, Events::POST_COMMIT);

return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/ParallelExecution/ParallelExecution.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down

0 comments on commit 48420e8

Please sign in to comment.