function EntitySave::doExecute

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 51

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;
    }
}