You are here

public function Condition::save in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Entity/Condition.php \Drupal\business_rules\Entity\Condition::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/Condition.php, line 121

Class

Condition
Defines the Condition entity.

Namespace

Drupal\business_rules\Entity

Code

public function save() {

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