You are here

protected function RelationLookup::query in CRM Core 8.3

Lookup value.

Parameters

mixed $value: The value to query.

Return value

mixed|null Entity id if the queried entity exists. Otherwise NULL.

1 call to RelationLookup::query()
RelationLookup::transform in modules/crm_core_user_sync/src/Plugin/migrate/process/RelationLookup.php
Performs the associated process.

File

modules/crm_core_user_sync/src/Plugin/migrate/process/RelationLookup.php, line 120

Class

RelationLookup
This plugin looks up relations of users to CRM individuals.

Namespace

Drupal\crm_core_user_sync\Plugin\migrate\process

Code

protected function query($value) {
  $multiple = is_array($value);
  $results = [];
  if ($multiple) {
    foreach ($value as $id) {
      $results[] = $this->crmCoreUserSyncRelation
        ->getIndividualIdFromUserId($id);
    }
  }
  else {
    $results[] = $this->crmCoreUserSyncRelation
      ->getIndividualIdFromUserId($value);
  }
  return $multiple ? array_values($results) : reset($results);
}