You are here

public static function MaestroEngine::updateEntityIdentifierByEntityTableID in Maestro 8.2

Same name and namespace in other branches
  1. 3.x src/Engine/MaestroEngine.php \Drupal\maestro\Engine\MaestroEngine::updateEntityIdentifierByEntityTableID()

Updates an existing maestro_entity_identifiers entity using the maestro_entity_identifiers table ID as the key.

Parameters

int $entityIdentifierID: The entity identifier ID.

string $entityID: The entity ID.

string $entityType: The type of entity.

string $entityBundle: The entity bundle.

string $taskUniqueID: The unique identifier associated to the entity.

File

src/Engine/MaestroEngine.php, line 969

Class

MaestroEngine
Class MaestroEngine.

Namespace

Drupal\maestro\Engine

Code

public static function updateEntityIdentifierByEntityTableID($entityIdentifierID, $entityID = NULL, $entityType = NULL, $entityBundle = NULL, $taskUniqueID = NULL) {
  if (isset($entityIdentifierID)) {
    $record = \Drupal::entityTypeManager()
      ->getStorage('maestro_entity_identifiers')
      ->load($entityIdentifierID);
    if ($record) {
      if (isset($taskUniqueID)) {
        $record
          ->set('unique_id', $taskUniqueID);
      }
      if (isset($entityType)) {
        $record
          ->set('entity_type', $entityType);
      }
      if (isset($entityID)) {
        $record
          ->set('entity_id', $entityID);
      }
      if (isset($entityBundle)) {
        $record
          ->set('bundle', $entityBundle);
      }
      $record
        ->save();
    }
  }
}