Skip to content

Commit

Permalink
Merge pull request #19966 from terabytesoftw/remove-deprecated-method…
Browse files Browse the repository at this point in the history
…s-query

Remove deprecated methods to `Query::class`.
  • Loading branch information
bizley authored Sep 30, 2023
2 parents ce68c7e + fc21394 commit 169c5fb
Showing 1 changed file with 0 additions and 53 deletions.
53 changes: 0 additions & 53 deletions framework/db/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -715,59 +715,6 @@ protected function normalizeSelect($columns)
return $select;
}

/**
* Returns unique column names excluding duplicates.
* Columns to be removed:
* - if column definition already present in SELECT part with same alias
* - if column definition without alias already present in SELECT part without alias too
* @param array $columns the columns to be merged to the select.
* @since 2.0.14
* @deprecated in 2.0.21
*/
protected function getUniqueColumns($columns)
{
$unaliasedColumns = $this->getUnaliasedColumnsFromSelect();

$result = [];
foreach ($columns as $columnAlias => $columnDefinition) {
if (!$columnDefinition instanceof Query) {
if (is_string($columnAlias)) {
$existsInSelect = isset($this->select[$columnAlias]) && $this->select[$columnAlias] === $columnDefinition;
if ($existsInSelect) {
continue;
}
} elseif (is_int($columnAlias)) {
$existsInSelect = in_array($columnDefinition, $unaliasedColumns, true);
$existsInResultSet = in_array($columnDefinition, $result, true);
if ($existsInSelect || $existsInResultSet) {
continue;
}
}
}

$result[$columnAlias] = $columnDefinition;
}
return $result;
}

/**
* @return array List of columns without aliases from SELECT statement.
* @since 2.0.14
* @deprecated in 2.0.21
*/
protected function getUnaliasedColumnsFromSelect()
{
$result = [];
if (is_array($this->select)) {
foreach ($this->select as $name => $value) {
if (is_int($name)) {
$result[] = $value;
}
}
}
return array_unique($result);
}

/**
* Sets the value indicating whether to SELECT DISTINCT or not.
* @param bool $value whether to SELECT DISTINCT or not.
Expand Down

0 comments on commit 169c5fb

Please sign in to comment.