You are here

protected function TeamMemberRoleStorage::doSave in Apigee Edge 8

Performs storage-specific saving of the entity.

Parameters

int|string $id: The original entity ID.

\Drupal\Core\Entity\EntityInterface $entity: The entity to save.

Return value

bool|int If the record insert or update failed, returns FALSE. If it succeeded, returns SAVED_NEW or SAVED_UPDATED, depending on the operation performed.

Overrides ContentEntityStorageBase::doSave

File

modules/apigee_edge_teams/src/Entity/Storage/TeamMemberRoleStorage.php, line 248

Class

TeamMemberRoleStorage
Entity storage class for team member role entities.

Namespace

Drupal\apigee_edge_teams\Entity\Storage

Code

protected function doSave($id, EntityInterface $entity) {

  /** @var \Drupal\apigee_edge_teams\Entity\TeamMemberRoleInterface $entity */
  $return = parent::doSave($id, $entity);
  if ($return === SAVED_NEW) {

    // Invalidate team related caches - for example the render cache of
    // the team members list - if the developer did not have a developer
    // team role entity before.
    // @see \Drupal\apigee_edge_teams\Controller\TeamMembersList::buildRow()
    Cache::invalidateTags($entity
      ->getTeam()
      ->getCacheTags());
  }
  return $return;
}