You are here

public function Action::save in Business Rules 8

Same name and namespace in other branches
  1. 2.x src/Entity/Action.php \Drupal\business_rules\Entity\Action::save()

Saves an entity permanently.

When saving existing entities, the entity is assumed to be complete, partial updates of entities are not supported.

Return value

int Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.

Throws

\Drupal\Core\Entity\EntityStorageException In case of failures an exception is thrown.

Overrides ConfigEntityBase::save

File

src/Entity/Action.php, line 76

Class

Action
Defines the Action entity.

Namespace

Drupal\business_rules\Entity

Code

public function save() {

  // Prevent action to have the same name as one existent condition.
  $condition = Condition::load($this
    ->id());
  if (!empty($condition)) {
    $this->id = 'a_' . $this
      ->id();
  }
  return parent::save();
}