You are here

public static function MaestroEngine::createEntityIdentifier in Maestro 8.2

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

Creates a maestro_entity_identifier entity entry.

Parameters

int $processID: The Maestro Process ID.

string $entityType: The type of entity you are saving.

string $entityBundle: The bundle of the entity.

string $taskUniqueID: The unique ID you are associating to the entity identifier.

string|int $entityID: The ID of the entity.

Return value

int|string|null The row ID (entity ID) of the newly created maestro_entity_identifiers if successful. NULL if not successful.

4 calls to MaestroEngine::createEntityIdentifier()
MaestroRulesActionSpawnWorkflow::doExecute in src/Plugin/RulesAction/MaestroRulesActionSpawnWorkflow.php
Spawns a workflow.
MaestroWebformHandler::postSave in modules/maestro_webform/src/Plugin/WebformHandler/MaestroWebformHandler.php
Acts on a saved webform submission before the insert or update hook is invoked.
maestro_content_type_task_submit in ./maestro.module
Handling the submission from a content type task. This will offload the saving from the content type task plugin.
maestro_webform_webform_type_task_submit in modules/maestro_webform/maestro_webform.module
Implements hook_webform_type_task_submit().

File

src/Engine/MaestroEngine.php, line 938

Class

MaestroEngine
Class MaestroEngine.

Namespace

Drupal\maestro\Engine

Code

public static function createEntityIdentifier($processID, $entityType, $entityBundle, $taskUniqueID, $entityID) {
  if (isset($processID) && isset($entityType) && isset($entityBundle) && isset($taskUniqueID) && isset($entityID)) {
    $values = [
      'process_id' => $processID,
      'unique_id' => $taskUniqueID,
      'entity_type' => $entityType,
      'entity_id' => $entityID,
      'bundle' => $entityBundle,
    ];
    $new_entry = \Drupal::entityTypeManager()
      ->getStorage('maestro_entity_identifiers')
      ->create($values);
    $new_entry
      ->save();
    return $new_entry
      ->id();
  }
  return NULL;
}