You are here

public static function MaestroEngine::getEntityIdentiferFieldsByUniqueID in Maestro 8.2

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

Fetches the full record of the maestro_entity_identifiers entity for the process and unique ID.

Parameters

int $processID: The process ID from the workflow.

string $taskUniqueID: The unique identifier given to the entity in the task definition.

Return value

array An array of arrays keyed by the task's unique identifier for the entity. Empty array if nothing found.

1 call to MaestroEngine::getEntityIdentiferFieldsByUniqueID()
maestro_tokens in ./maestro.module
Implements hook_tokens().

File

src/Engine/MaestroEngine.php, line 1029

Class

MaestroEngine
Class MaestroEngine.

Namespace

Drupal\maestro\Engine

Code

public static function getEntityIdentiferFieldsByUniqueID($processID, $taskUniqueID) {
  $retArray = [];
  $query = \Drupal::entityQuery('maestro_entity_identifiers')
    ->condition('process_id', $processID)
    ->condition('unique_id', $taskUniqueID);
  $entityIDs = $query
    ->execute();
  foreach ($entityIDs as $entityID) {
    $record = \Drupal::entityTypeManager()
      ->getStorage('maestro_entity_identifiers')
      ->load($entityID);
    if ($record) {
      $retArray[$record->unique_id
        ->getString()] = [
        'unique_id' => $record->unique_id
          ->getString(),
        'entity_type' => $record->entity_type
          ->getString(),
        'bundle' => $record->bundle
          ->getString(),
        'entity_id' => $record->entity_id
          ->getString(),
      ];
    }
  }
  return $retArray;
}