You are here

public function SalesforceCommands::readObject in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 src/Commands/SalesforceCommands.php \Drupal\salesforce\Commands\SalesforceCommands::readObject()
  2. 5.0.x src/Commands/SalesforceCommands.php \Drupal\salesforce\Commands\SalesforceCommands::readObject()

Retrieve all the data for an object with a specific ID.

@todo create a proper StructuredData return value

@command salesforce:read-object @aliases sfro,sf-read-object

Parameters

string $id: A Salesforce ID.

Throws

\Exception

File

src/Commands/SalesforceCommands.php, line 484

Class

SalesforceCommands
A Drush commandfile.

Namespace

Drupal\salesforce\Commands

Code

public function readObject($id) {
  $name = $this->client
    ->getObjectTypeName(new SFID($id));
  if ($object = $this->client
    ->objectRead($name, $id)) {
    $this
      ->output()
      ->writeln(dt("!type with id !id", [
      '!type' => $object
        ->type(),
      '!id' => $object
        ->id(),
    ]));
    $this
      ->output()
      ->writeln(print_r($object
      ->fields(), 1));
  }
}