class QueryResult in Salesforce Suite 5.0.x
Same name and namespace in other branches
- 8.4 src/Commands/QueryResult.php \Drupal\salesforce\Commands\QueryResult
- 8.3 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 {
/**
* Size of query result.
*
* @var int
*/
protected $size;
/**
* Total records returned by query.
*
* @var int
*/
protected $total;
/**
* The query.
*
* @var \Drupal\salesforce\SelectQueryInterface
*/
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) {
$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 | The query. | |
QueryResult:: |
protected | property | Size of query result. | |
QueryResult:: |
protected | property | Total records returned by query. | |
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. |