Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: Adjust types of IQueryBuilder to properly allow joining with sub…
…-query

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Sep 10, 2024
commit 027fc052e78cb8401b3805c26a349c859ba7f275
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function innerJoin($fromAlias, $join, $alias, $condition = null): self {
}

public function leftJoin($fromAlias, $join, $alias, $condition = null): self {
return $this->join($fromAlias, $join, $alias, $condition, PartitionQuery::JOIN_MODE_LEFT);
return $this->join($fromAlias, (string)$join, $alias, $condition, PartitionQuery::JOIN_MODE_LEFT);
}

public function join($fromAlias, $join, $alias, $condition = null, $joinMode = PartitionQuery::JOIN_MODE_INNER): self {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/DB/QueryBuilder/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ public function innerJoin($fromAlias, $join, $alias, $condition = null) {
* </code>
*
* @param string $fromAlias The alias that points to a from clause.
* @param string $join The table name to join.
* @param string|IQueryFunction $join The table name or sub-query to join.
* @param string $alias The alias of the join table.
* @param string|ICompositeExpression|null $condition The condition for the join.
*
Expand Down
8 changes: 6 additions & 2 deletions lib/public/DB/QueryBuilder/IQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,12 +541,13 @@ public function innerJoin($fromAlias, $join, $alias, $condition = null);
* </code>
*
* @param string $fromAlias The alias that points to a from clause.
* @param string $join The table name to join.
* @param string|IQueryFunction $join The table name to join.
* @param string $alias The alias of the join table.
* @param string|ICompositeExpression|null $condition The condition for the join.
*
* @return $this This QueryBuilder instance.
* @since 8.2.0
* @since 30.0.0 Allow passing IQueryFunction as parameter for `$join` to allow join with a sub-query.
*
* @psalm-taint-sink sql $fromAlias
* @psalm-taint-sink sql $join
Expand Down Expand Up @@ -1001,11 +1002,14 @@ public function createFunction($call);
public function getLastInsertId(): int;

/**
* Returns the table name quoted and with database prefix as needed by the implementation
* Returns the table name quoted and with database prefix as needed by the implementation.
* If a query function is passed the function is casted to string,
* this allows passing functions as sub-queries for join expression.
*
* @param string|IQueryFunction $table
* @return string
* @since 9.0.0
* @since 24.0.0 accepts IQueryFunction as parameter
*/
public function getTableName($table);

Expand Down