Skip to content

Commit

Permalink
DB: Updates should use set()
Browse files Browse the repository at this point in the history
Issue GH-1211

Signed-off-by: Sean Molenaar <sean@seanmolenaar.eu>
  • Loading branch information
SMillerDev committed Mar 1, 2021
1 parent 59885c2 commit db796ed
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is almost based on [Keep a Changelog](https://keepachangelog.com/en/1
### Changed

### Fixed
- Fix update queries (#1211)

## [15.4.0-beta2] - 2021-02-27
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/FeedMapperV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function read(string $userId, int $id, ?int $maxItemID = null): void
$builder = $this->db->getQueryBuilder();
$builder->update(ItemMapperV2::TABLE_NAME, 'items')
->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id')
->setValue('unread', 0)
->set('unread', 0)
->andWhere('feeds.user_id = :userId')
->andWhere('feeds.id = :feedId')
->setParameter('userId', $userId)
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/FolderMapperV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function read(string $userId, int $id, ?int $maxItemID = null): void
$builder = $this->db->getQueryBuilder();
$builder->update(ItemMapperV2::TABLE_NAME, 'items')
->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id')
->setValue('unread', 0)
->set('unread', 0)
->andWhere('feeds.user_id = :userId')
->andWhere('feeds.folder_id = :folderId')
->setParameter('userId', $userId)
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/ItemMapperV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function readAll(string $userId, int $maxItemId): void

$builder->update($this->tableName, 'items')
->innerJoin('items', FeedMapperV2::TABLE_NAME, 'feeds', 'items.feed_id = feeds.id')
->setValue('unread', 0)
->set('unread', 0)
->andWhere('items.id =< :maxItemId')
->andWhere('feeds.user_id = :userId')
->setParameter('maxItemId', $maxItemId)
Expand Down
6 changes: 3 additions & 3 deletions tests/Unit/Db/FeedMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public function testRead()
->will($this->returnSelf());

$this->builder->expects($this->once())
->method('setValue')
->method('set')
->with('unread', 0)
->will($this->returnSelf());

Expand Down Expand Up @@ -517,7 +517,7 @@ public function testReadWithMaxId()
->will($this->returnSelf());

$this->builder->expects($this->once())
->method('setValue')
->method('set')
->with('unread', 0)
->will($this->returnSelf());

Expand All @@ -541,4 +541,4 @@ public function testReadWithMaxId()

$this->class->read('admin', 1, 4);
}
}
}
6 changes: 3 additions & 3 deletions tests/Unit/Db/FolderMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public function testRead()
->will($this->returnSelf());

$this->builder->expects($this->once())
->method('setValue')
->method('set')
->with('unread', 0)
->will($this->returnSelf());

Expand Down Expand Up @@ -345,7 +345,7 @@ public function testReadWithMaxId()
->will($this->returnSelf());

$this->builder->expects($this->once())
->method('setValue')
->method('set')
->with('unread', 0)
->will($this->returnSelf());

Expand All @@ -369,4 +369,4 @@ public function testReadWithMaxId()

$this->class->read('admin', 1, 4);
}
}
}
4 changes: 2 additions & 2 deletions tests/Unit/Db/ItemMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public function testReadAll()
->will($this->returnSelf());

$this->builder->expects($this->once())
->method('setValue')
->method('set')
->with('unread', 0)
->will($this->returnSelf());

Expand Down Expand Up @@ -1055,4 +1055,4 @@ public function testDeleteOverThresholdSuccessUnreadSkipsIfUnderThreshold()
$this->assertSame(10, $res);
}

}
}

0 comments on commit db796ed

Please sign in to comment.