Skip to content

Commit

Permalink
Avoid index update when auto-saving or only-saving version (#144)
Browse files Browse the repository at this point in the history
* do not update index when auto save or only saving version

* Apply php-cs-fixer changes

Co-authored-by: kingjia90 <[email protected]>
  • Loading branch information
kingjia90 and kingjia90 authored Feb 22, 2022
1 parent b343646 commit ff0a56c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/EventListener/IndexUpdateListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ public function __construct(Service $service)

public function updateObject(DataObjectEvent $event)
{
//do not update index when auto save or only saving version
if (
($event->hasArgument('isAutoSave') && $event->getArgument('isAutoSave')) ||
($event->hasArgument('saveVersionOnly') && $event->getArgument('saveVersionOnly'))
) {
return;
}

$inheritanceBackup = AbstractObject::getGetInheritedValues();
AbstractObject::setGetInheritedValues(true);

Expand Down

0 comments on commit ff0a56c

Please sign in to comment.