You are here

protected function EntitySave::doExecute in Rules 8.3

Saves the Entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to be saved.

bool $immediate: (optional) Save the entity immediately.

File

src/Plugin/RulesAction/EntitySave.php, line 50

Class

EntitySave
Provides a 'Save entity' action.

Namespace

Drupal\rules\Plugin\RulesAction

Code

protected function doExecute(EntityInterface $entity, $immediate) {

  // We only need to do something here if the immediate flag is set, otherwise
  // the entity will be auto-saved after the execution.
  if ((bool) $immediate) {
    $entity
      ->save();
    $this->saveLater = FALSE;
  }
}