You are here

function services_client_raw_data_get in Services Client 7

Retrieve data from source object by $path which can be entered in UI.

Parameters

string $path: Path should be in fomrat property#>index1#>index2#>value

object $source: Source object

1 call to services_client_raw_data_get()
services_client_process_mapping in ./services_client.module
Process the mapping lists for fields

File

./services_client.module, line 963
Services client module allows to push different types of objects on different types of events such as node_save, user_save to remote masters.

Code

function services_client_raw_data_get($path, $source) {

  // Explode the segments by #
  $parts = explode('#', trim($path));

  // Create reference to initial data source
  $data = $source;
  foreach ($parts as $part) {

    // Get correct name
    if (substr($part, 0, 1) == '>') {
      $name = substr($part, 1);
      if (isset($data[$name])) {
        $data = $data[$name];
      }
      else {
        throw new ServicesClientDataNotFoundException();
      }
    }
    else {
      $name = $part;
      if (isset($data->{$name})) {
        $data = $data->{$name};
      }
      else {
        throw new ServicesClientDataNotFoundException();
      }
    }
  }
  return $data;
}