Skip to content

Commit

Permalink
remove from API possibility to add array with values
Browse files Browse the repository at this point in the history
  • Loading branch information
forrest79 committed Jan 15, 2024
1 parent cb001a5 commit 2894822
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Fluent/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public function merge(?string $into = NULL, ?string $alias = NULL): Query


/**
* @param array<string, mixed>|string|Query|Db\Sql $dataSource values, table or query
* @param string|Query|Db\Sql $dataSource values, table or query
* @param string|Complex|Db\Sql|NULL $onCondition
* @return QueryExecute
* @throws Exceptions\QueryException
Expand Down
11 changes: 10 additions & 1 deletion src/Fluent/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class Query implements Sql
public const MERGE_USING_DATA_SOURCE = 'using-data-source';
public const MERGE_USING_ALIAS = 'using-alias';
public const MERGE_WHEN = 'when';
public const MERGE_WHEN_MATCHED = 'when-matched';
public const MERGE_WHEN_NOT_MATCHED = 'when-not-matched';

public const WITH_QUERIES = 'queries';
public const WITH_QUERIES_SUFFIX = 'queries-suffix';
Expand Down Expand Up @@ -672,7 +674,7 @@ public function merge(?string $into = NULL, ?string $alias = NULL): self


/**
* @param array<string, mixed>|string|self|Db\Sql $dataSource values, table or query
* @param string|self|Db\Sql $dataSource values, table or query
* @param string|Complex|Db\Sql|NULL $onCondition
* @return static
* @throws Exceptions\QueryException
Expand All @@ -682,6 +684,7 @@ public function using($dataSource, ?string $alias = NULL, $onCondition = NULL):
$this->resetQuery();
$this->queryType = self::QUERY_MERGE;
$this->params[self::MERGE_USING_DATA_SOURCE] = $dataSource;
$this->params[self::MERGE_USING_ALIAS] = $alias;
return $this;
}

Expand All @@ -693,6 +696,9 @@ public function using($dataSource, ?string $alias = NULL, $onCondition = NULL):
*/
public function whenMatched(string $then, $onCondition = NULL): self
{
$this->resetQuery();
$this->params[self::MERGE_WHEN][] = [self::MERGE_WHEN_MATCHED, $then, $onCondition];
return $this;
}


Expand All @@ -703,6 +709,9 @@ public function whenMatched(string $then, $onCondition = NULL): self
*/
public function whenNotMatched(string $then, $onCondition = NULL): self
{
$this->resetQuery();
$this->params[self::MERGE_WHEN][] = [self::MERGE_WHEN_NOT_MATCHED, $then, $onCondition];
return $this;
}


Expand Down
2 changes: 1 addition & 1 deletion src/Fluent/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function merge(?string $into = NULL, ?string $alias = NULL): Query;


/**
* @param array<string, mixed>|string|Query|Db\Sql $dataSource values, table or query
* @param string|Query|Db\Sql $dataSource values, table or query
* @param string|Complex|Db\Sql|NULL $onCondition
*/
function using($dataSource, ?string $alias = NULL, $onCondition = NULL): Query;
Expand Down

0 comments on commit 2894822

Please sign in to comment.