Skip to content

Commit 6a6c08b

Browse files
committed
Reverse column and row order when deleting
Signed-off-by: Enjeck C. <patrathewhiz@gmail.com>
1 parent bb458af commit 6a6c08b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/Db/Row2Mapper.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ private function insertOrUpdateCell(int $rowId, int $columnId, $value): void {
767767
$this->atomic(function () use ($cellMapper, $rowId, $columnId, $value) {
768768
// For a usergroup field with mutiple values, each is inserted as a new cell
769769
// we need to delete all previous cells for this row and column, otherwise we get duplicates
770-
$cellMapper->deleteAllForRowAndColumn($rowId, $columnId);
770+
$cellMapper->deleteAllForColumnAndRow($columnId, $rowId);
771771
$this->insertCell($rowId, $columnId, $value);
772772
}, $this->db);
773773
} else {

lib/Db/RowCellMapperSuper.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ public function deleteAllForRow(int $rowId): void {
7575
/**
7676
* @throws Exception
7777
*/
78-
public function deleteAllForRowAndColumn(int $rowId, int $columnId): void {
78+
public function deleteAllForColumnAndRow(int $columnId, int $rowId): void {
7979
$qb = $this->db->getQueryBuilder();
8080
$qb->delete($this->tableName)
8181
->where(
82-
$qb->expr()->eq('row_id', $qb->createNamedParameter($rowId, IQueryBuilder::PARAM_INT))
82+
$qb->expr()->eq('column_id', $qb->createNamedParameter($columnId, IQueryBuilder::PARAM_INT))
8383
)
8484
->andWhere(
85-
$qb->expr()->eq('column_id', $qb->createNamedParameter($columnId, IQueryBuilder::PARAM_INT))
85+
$qb->expr()->eq('row_id', $qb->createNamedParameter($rowId, IQueryBuilder::PARAM_INT))
8686
);
8787
$qb->executeStatement();
8888
}

0 commit comments

Comments
 (0)