You are here

public function QueryResult::__construct in Salesforce Suite 8.4

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

QueryResult constructor.

Parameters

\Drupal\salesforce\SelectQueryInterface $query: SOQL query.

\Drupal\salesforce\SelectQueryResult $queryResult: SOQL result.

File

src/Commands/QueryResult.php, line 43

Class

QueryResult
Adds structured metadata to RowsOfFieldsWithMetadata.

Namespace

Drupal\salesforce\Commands

Code

public function __construct(SelectQueryInterface $query, SelectQueryResult $queryResult) {
  $data = [];
  foreach ($queryResult
    ->records() as $id => $record) {
    $data[$id] = $record
      ->fields();
  }
  parent::__construct($data);
  $this->size = count($queryResult
    ->records());
  $this->total = $queryResult
    ->size();
  $this->query = $query;
}