Skip to content

Commit 39872b1

Browse files
Tigrovvjik
andauthored
Refactor DMLQueryBuilder (#746)
* Refactor DMLQueryBuilder * Get uniques using `getTableIndexes()` and `getTableUniques()` * Fix @psalm-var * Fix #61 (point 2) * Fix #61 (point 2) add test * Improve test * Remove methods with `NotSupportedException` * Fix test issues * Fix test issues * Revert "Remove methods with `NotSupportedException`" * Add line to CHANGELOG.md * Change order of checks * Improve performance of quoting column names up to 10% using `array_map()` * Update CHANGELOG.md * remove `Generator` in `DMLQueryBuilderInterface` * Update psalm * Apply suggestions from code review Co-authored-by: Sergei Predvoditelev <sergey.predvoditelev@gmail.com> * Apply StyleCI * Remove `Generator` from other places * Return and deprecate `getTypecastValue()` method and `$table` parameter * Fix psalm * Fix psalm * Update CHANGELOG.md --------- Co-authored-by: Sergei Predvoditelev <sergey.predvoditelev@gmail.com>
1 parent 4f1dbb9 commit 39872b1

10 files changed

Lines changed: 163 additions & 164 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## 1.1.2 under development
44

5+
- Enh #746: Refactor `AbstractDMLQueryBuilder` (@Tigrov)
6+
- Bug #746: Fix `AbstractDMLQueryBuilder::upsert()` when unique index is not at the first position of inserted values (@Tigrov)
7+
- Bug #746: Typecast values in `AbstractDMLQueryBuilder::batchInsert()` if column names with table name and brackets (@Tigrov)
8+
- Bug #746, #61: Typecast values in `AbstractDMLQueryBuilder::batchInsert()` if values with string keys (@Tigrov)
9+
- Enh #746: Enhanced documentation of `batchInsert()` and `update()` methods of `DMLQueryBuilderInterface` interface (@Tigrov)
510
- Bug #751: Fix collected debug actions (@xepozz)
611
- Chg #755: Deprecate `TableSchemaInterface::compositeForeignKey()` (@Tigrov)
712
- Enh #756: Refactor `Quoter` (@Tigrov)

psalm.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
<directory name="vendor" />
1515
</ignoreFiles>
1616
</projectFiles>
17+
<issueHandlers>
18+
<MixedAssignment errorLevel="suppress" />
19+
</issueHandlers>
1720
</psalm>

src/Command/CommandInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ public function alterColumn(string $table, string $column, ColumnInterface|strin
177177
* @throws Exception
178178
* @throws InvalidArgumentException
179179
*
180+
* @psalm-param iterable<array-key, array<array-key, mixed>> $rows
181+
*
180182
* Note: The method will quote the `table` and `column` parameters before using them in the generated SQL.
181183
*/
182184
public function batchInsert(string $table, array $columns, iterable $rows): static;
@@ -820,6 +822,8 @@ public function update(string $table, array $columns, array|string $condition =
820822
* @throws JsonException
821823
* @throws NotSupportedException
822824
*
825+
* @psalm-param array<string, mixed>|QueryInterface $insertColumns
826+
*
823827
* Note: The method will quote the `table` and `insertColumns`, `updateColumns` parameters before using it in the
824828
* generated SQL.
825829
*/

0 commit comments

Comments
 (0)