isSimpleQuery example

$this->sort = [];
    }
    // Gather the SQL field aliases first to make sure every field table     // necessary is added. This might change whether the query is simple or     // not. See below for more on simple queries.     $sort = [];
    if ($this->sort) {
      foreach ($this->sort as $key => $data) {
        $sort[$key] = $this->getSqlField($data['field']$data['langcode']);
      }
    }
    $simple_query = $this->isSimpleQuery();
    // If the query is set up for paging either via pager or by range or a     // count is requested, then the correct amount of rows returned is     // important. If the entity has a data table or multiple value fields are     // involved then each revision might appear in several rows and this needs     // a significantly more complex query.     if (!$simple_query) {
      // First, GROUP BY revision id (if it has been added) and entity id.       // Now each group contains a single revision of an entity.       foreach ($this->sqlFields as $field) {
        $group_by = "$field[0].$field[1]";
        $this->sqlGroupBy[$group_by] = $group_by;
      }
/** * {@inheritdoc} */
  public function isSimpleQuery() {
    // We declare that this is not a simple query in     // \Drupal\workspaces\EntityQuery\QueryTrait::prepare(), but that's not     // enough because the parent method can return TRUE in some circumstances.     if ($this->sqlQuery->getMetaData('active_workspace_id')) {
      return FALSE;
    }

    return parent::isSimpleQuery();
  }

}
Home | Imprint | This part of the site doesn't use cookies.