Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2018-08-16 15:37:39 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2018-08-16 15:37:39 +0300
commit02dd95d10de041278d8bc05f7f548e44471db60b (patch)
tree53fe3c41a85cacb7794179460815cb2f29571ffb /lib
parent22f15363c29f1ee7227d6aab219f8e6fad932ff7 (diff)
Migrate the LocalAttachmentsMapper to the QBMapper
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/Db/LocalAttachmentMapper.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Db/LocalAttachmentMapper.php b/lib/Db/LocalAttachmentMapper.php
index c4c932b8f..bd98e14bf 100644
--- a/lib/Db/LocalAttachmentMapper.php
+++ b/lib/Db/LocalAttachmentMapper.php
@@ -23,10 +23,10 @@
namespace OCA\Mail\Db;
use OCP\AppFramework\Db\DoesNotExistException;
-use OCP\AppFramework\Db\Mapper;
+use OCP\AppFramework\Db\QBMapper;
use OCP\IDBConnection;
-class LocalAttachmentMapper extends Mapper {
+class LocalAttachmentMapper extends QBMapper {
/**
* @param IDBConnection $db
@@ -37,15 +37,20 @@ class LocalAttachmentMapper extends Mapper {
/**
* @throws DoesNotExistException
+ *
* @param int $userId
* @param int $id
+ *
* @return LocalAttachment
*/
public function find($userId, $id) {
- $sql = 'SELECT * FROM `' . $this->getTableName() . '` WHERE user_id = ? and id = ?';
- $params = [$userId, $id];
+ $qb = $this->db->getQueryBuilder();
+ $query = $qb
+ ->select('*')
+ ->from($this->getTableName())
+ ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
- return $this->findEntity($sql, $params);
+ return $this->findEntity($query);
}
}