You are here

public function CivicrmEntity::save in CiviCRM Entity 8.3

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 EntityBase::save

File

src/Entity/CivicrmEntity.php, line 42

Class

CivicrmEntity
Entity class for CiviCRM entities.

Namespace

Drupal\civicrm_entity\Entity

Code

public function save() {

  // Set ::drupal_crud to indicate save is coming from Drupal.
  try {
    $this->drupal_crud = TRUE;
    $result = parent::save();
  } finally {
    $this->drupal_crud = FALSE;
  }
  return $result;
}