summaryrefslogtreecommitdiffstats
path: root/apps/twofactor_backupcodes/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-01-14 15:50:04 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2019-01-14 15:50:04 +0100
commit49a4f2fd61b0e9fe0b153b9543f7185fa808da74 (patch)
treecce7930d450bf5bbb1d1d79c3f83257eed4302a2 /apps/twofactor_backupcodes/lib
parent86d30835af2a91e7d51a67c34de5ef77ce079b72 (diff)
downloadnextcloud-server-49a4f2fd61b0e9fe0b153b9543f7185fa808da74.tar.gz
nextcloud-server-49a4f2fd61b0e9fe0b153b9543f7185fa808da74.zip
Switch to QBMapper
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/twofactor_backupcodes/lib')
-rw-r--r--apps/twofactor_backupcodes/lib/Db/BackupCodeMapper.php11
1 files changed, 3 insertions, 8 deletions
diff --git a/apps/twofactor_backupcodes/lib/Db/BackupCodeMapper.php b/apps/twofactor_backupcodes/lib/Db/BackupCodeMapper.php
index 03fe7bb5ec8..20a1134cff3 100644
--- a/apps/twofactor_backupcodes/lib/Db/BackupCodeMapper.php
+++ b/apps/twofactor_backupcodes/lib/Db/BackupCodeMapper.php
@@ -22,11 +22,12 @@
namespace OCA\TwoFactorBackupCodes\Db;
use OCP\AppFramework\Db\Mapper;
+use OCP\AppFramework\Db\QBMapper;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use OCP\IUser;
-class BackupCodeMapper extends Mapper {
+class BackupCodeMapper extends QBMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'twofactor_backupcodes');
@@ -43,14 +44,8 @@ class BackupCodeMapper extends Mapper {
$qb->select('id', 'user_id', 'code', 'used')
->from('twofactor_backupcodes')
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($user->getUID())));
- $result = $qb->execute();
- $rows = $result->fetchAll();
- $result->closeCursor();
-
- return array_map(function ($row) {
- return BackupCode::fromRow($row);
- }, $rows);
+ return self::findEntities($qb);
}
/**