function Query::result
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/Query/Sql/Query.php \Drupal\Core\Entity\Query\Sql\Query::result()
- 8.9.x core/lib/Drupal/Core/Entity/Query/Sql/Query.php \Drupal\Core\Entity\Query\Sql\Query::result()
- 11.x core/lib/Drupal/Core/Entity/Query/Sql/Query.php \Drupal\Core\Entity\Query\Sql\Query::result()
Executes the query and returns the result.
Return value
int|array Returns the query result as entity IDs.
1 call to Query::result()
- QueryAggregate::result in core/
lib/ Drupal/ Core/ Entity/ Query/ Sql/ QueryAggregate.php - Overrides \Drupal\Core\Entity\Query\Sql\Query::result().
1 method overrides Query::result()
- QueryAggregate::result in core/
lib/ Drupal/ Core/ Entity/ Query/ Sql/ QueryAggregate.php - Overrides \Drupal\Core\Entity\Query\Sql\Query::result().
File
-
core/
lib/ Drupal/ Core/ Entity/ Query/ Sql/ Query.php, line 265
Class
- Query
- The SQL storage entity query class.
Namespace
Drupal\Core\Entity\Query\SqlCode
protected function result() {
if ($this->count) {
return (int) $this->sqlQuery
->countQuery()
->execute()
->fetchField();
}
// Return a keyed array of results. The key is either the revision_id or
// the entity_id depending on whether the entity type supports revisions.
// The value is always the entity id.
return $this->sqlQuery
->execute()
->fetchAllKeyed();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.