You are here

public function EventHandler::getRemoteEntityId in Services Client 7.2

Retrieve remote entity ID.

Return value

mixed|NULL If no remote entity exists returns NULL

Throws

ServicesClientConnectionResponseException

3 calls to EventHandler::getRemoteEntityId()
EntityDeleteHandler::doSync in include/event.inc
Execute sync action.
EntitySaveHandler::doSync in include/event.inc
Execute sync action.
UserSaveHandler::getRemoteEntityId in include/event.inc
Override get remote id. This allows to sync users by name.
1 method overrides EventHandler::getRemoteEntityId()
UserSaveHandler::getRemoteEntityId in include/event.inc
Override get remote id. This allows to sync users by name.

File

include/event.inc, line 574

Class

EventHandler
Event handler plugin.

Code

public function getRemoteEntityId() {

  // For entities that don't provide UUID don't search for remote match.
  if (!isset($this
    ->getEntity()->uuid)) {
    $this
      ->log(ServicesClientLogLevel::ERROR, "MISSING ENTITY UUID; entity : <pre>@entity</pre>", array(
      '@entity' => $this
        ->debugObject($this
        ->getEntity()),
    ));
    return NULL;
  }

  // Default result.
  $result = $this
    ->getRemoteIdByUUID($this
    ->getEntity()->uuid, $this->config['uuid_resource'], $this->config['uuid_resource']);

  // Log remote id.
  if (!empty($result)) {
    $this
      ->log(ServicesClientLogLevel::DEVEL, "FOUND ID; local uuid : @local_uuid, remote id : @remote_id", array(
      '@local_uuid' => $this
        ->getEntity()->uuid,
      '@remote_id' => $result,
    ));
  }
  else {
    $this
      ->log(ServicesClientLogLevel::DEVEL, "NOT FOUND ID; local uuid : @local_uuid", array(
      '@local_uuid' => $this
        ->getEntity()->uuid,
      '@remote_id' => $result,
    ));
  }
  return $result;
}