summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Db
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-04-13 17:11:25 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-04-26 10:35:37 +0200
commitb3e7865d9b3a88647107220fd9ac08f0d80ae1cd (patch)
treec981b013e63d97977e8654c659a60ffc233ba979 /apps/dav/lib/Db
parent5c6d3b4f41d420e2ea84ba71c8173dcf931a77c6 (diff)
downloadnextcloud-server-b3e7865d9b3a88647107220fd9ac08f0d80ae1cd.tar.gz
nextcloud-server-b3e7865d9b3a88647107220fd9ac08f0d80ae1cd.zip
Dav endpoint returns proper data
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/dav/lib/Db')
-rw-r--r--apps/dav/lib/Db/DirectMapper.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/apps/dav/lib/Db/DirectMapper.php b/apps/dav/lib/Db/DirectMapper.php
index 917fca2f920..806b145823e 100644
--- a/apps/dav/lib/Db/DirectMapper.php
+++ b/apps/dav/lib/Db/DirectMapper.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace OCA\DAV\Db;
+use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Db\Mapper;
use OCP\IDBConnection;
@@ -32,4 +33,24 @@ class DirectMapper extends Mapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'directlink', Direct::class);
}
+
+ public function getByToken(string $token): Direct {
+ $qb = $this->db->getQueryBuilder();
+
+ $qb->select('*')
+ ->from('directlink')
+ ->where(
+ $qb->expr()->eq('token', $qb->createNamedParameter($token))
+ );
+
+ $cursor = $qb->execute();
+ $data = $cursor->fetch();
+ $cursor->closeCursor();
+
+ if ($data === false) {
+ throw new DoesNotExistException();
+ }
+
+ return Direct::fromRow($data);
+ }
}