getSqlField example


  protected function addSort() {
    if ($this->count) {
      $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.


  /** * Adds the aggregations to the query. * * @return $this * Returns the called object. */
  protected function addAggregate() {
    if ($this->aggregate) {
      foreach ($this->aggregate as $aggregate) {
        $sql_field = $this->getSqlField($aggregate['field']$aggregate['langcode']);
        $sql_field_escaped = '[' . str_replace('.', '].[', $sql_field) . ']';
        $this->sqlExpressions[$aggregate['alias']] = $aggregate['function'] . "($sql_field_escaped)";
      }
    }
    return $this;
  }

  /** * Builds the aggregation conditions part of the query. * * @return $this * Returns the called object. */
Home | Imprint | This part of the site doesn't use cookies.