class QueryResult in Salesforce Suite 8.3
Same name and namespace in other branches
- 8.4 src/Commands/QueryResult.php \Drupal\salesforce\Commands\QueryResult
- 5.0.x src/Commands/QueryResult.php \Drupal\salesforce\Commands\QueryResult
Adds structured metadata to RowsOfFieldsWithMetadata.
Hierarchy
- class \Drupal\salesforce\Commands\QueryResult extends \Consolidation\OutputFormatters\StructuredData\RowsOfFieldsWithMetadata
Expanded class hierarchy of QueryResult
1 file declares its use of QueryResult
- SalesforceMappingCommandsBase.php in modules/
salesforce_mapping/ src/ Commands/ SalesforceMappingCommandsBase.php
File
- src/
Commands/ QueryResult.php, line 12
Namespace
Drupal\salesforce\CommandsView source
class QueryResult extends RowsOfFieldsWithMetadata {
protected $size;
protected $total;
protected $query;
/**
* QueryResult constructor.
*
* @param \Drupal\salesforce\SelectQueryInterface $query
* SOQL query.
* @param \Drupal\salesforce\SelectQueryResult $queryResult
* SOQL result.
*/
public function __construct(SelectQueryInterface $query, SelectQueryResult $queryResult) {
print_r($queryResult
->records());
$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;
}
/**
* Getter for query size (total number of records returned).
*
* @return int
* The size.
*/
public function getSize() {
return $this->size;
}
/**
* Getter for query total (total number of records available).
*
* @return mixed
* The total.
*/
public function getTotal() {
return $this->total;
}
/**
* Getter for query.
*
* @return \Drupal\salesforce\SelectQuery
* The query.
*/
public function getQuery() {
return $this->query;
}
/**
* Get a prettified query.
*
* @return string
* Strip '+' escaping from the query.
*/
public function getPrettyQuery() {
return str_replace('+', ' ', (string) $this->query);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
QueryResult:: |
protected | property | ||
QueryResult:: |
protected | property | ||
QueryResult:: |
protected | property | ||
QueryResult:: |
public | function | Get a prettified query. | |
QueryResult:: |
public | function | Getter for query. | |
QueryResult:: |
public | function | Getter for query size (total number of records returned). | |
QueryResult:: |
public | function | Getter for query total (total number of records available). | |
QueryResult:: |
public | function | QueryResult constructor. |