function Sql::getAllEntities

Same name and namespace in other branches
  1. 9 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::getAllEntities()
  2. 8.9.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::getAllEntities()
  3. 11.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::getAllEntities()

Gets all the involved entities of the view.

Return value

\Drupal\Core\Entity\EntityInterface[]

2 calls to Sql::getAllEntities()
Sql::getCacheMaxAge in core/modules/views/src/Plugin/views/query/Sql.php
The maximum age for which this object may be cached.
Sql::getCacheTags in core/modules/views/src/Plugin/views/query/Sql.php
The cache tags associated with this object.

File

core/modules/views/src/Plugin/views/query/Sql.php, line 1722

Class

Sql
Views query plugin for an SQL query.

Namespace

Drupal\views\Plugin\views\query

Code

protected function getAllEntities() {
    $entities = [];
    foreach ($this->view->result as $row) {
        if ($row->_entity) {
            $entities[] = $row->_entity;
        }
        foreach ($row->_relationship_entities as $entity) {
            $entities[] = $entity;
        }
    }
    return $entities;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.