You are here

public static function MaestroEngine::getProcessVariable in Maestro 8.2

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

Fetch the variable's value if it exists. Returns FALSE on not being able to find the variable.

Parameters

string $variableName: The variable name you wish to fetch the value of.

int $processID: The Maestro Process ID in which the variable exists.

Return value

bool|mixed Returns a boolean (FALSE) on failure or the value of the variable.

11 calls to MaestroEngine::getProcessVariable()
MaestroEngine::doProductionAssignmentNotifications in src/Engine/MaestroEngine.php
Internal method to do production assignment notifications.
MaestroEngine::productionAssignments in src/Engine/MaestroEngine.php
Using the queueID, the task's machine name and the template machine name, we assign the task using the appropriate method defined in the template.
MaestroIfTask::execute in src/Plugin/EngineTasks/MaestroIfTask.php
Part of the ExecutableInterface Execution of the Batch Function task will use the handler for this task as the executable function. .
MaestroSetProcessVariableTask::execute in src/Plugin/EngineTasks/MaestroSetProcessVariableTask.php
Part of the ExecutableInterface Execution of the set process variable task. We will read the data in the template for what we should do with the process variable .
MaestroSpawnSubFlowTask::execute in src/Plugin/EngineTasks/MaestroSpawnSubFlowTask.php
Part of the ExecutableInterface Execution of the Sub Flow task will create a new process and push all selected parent variables to the newly spawned sub process. The variables pushed to the sub process will be prefixed with…

... See full list

File

src/Engine/MaestroEngine.php, line 327

Class

MaestroEngine
Class MaestroEngine.

Namespace

Drupal\maestro\Engine

Code

public static function getProcessVariable($variableName, $processID) {
  $query = \Drupal::entityTypeManager()
    ->getStorage('maestro_process_variables')
    ->getQuery();
  $query
    ->condition('process_id', $processID)
    ->condition('variable_name', $variableName);
  $entity_ids = $query
    ->execute();

  // We are expecting only 1 result... if any.
  $val = FALSE;
  if (count($entity_ids) > 0) {
    $entityID = current($entity_ids);
    \Drupal::entityTypeManager()
      ->getStorage('maestro_process_variables')
      ->resetCache([
      $entityID,
    ]);
    $processVariableRecord = \Drupal::entityTypeManager()
      ->getStorage('maestro_process_variables')
      ->load($entityID);
    $val = $processVariableRecord->variable_value
      ->getString();
  }
  return $val;
}