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

github.com/nextcloud/polls.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/Db
diff options
context:
space:
mode:
authordartcafe <github@dartcafe.de>2020-04-10 16:22:59 +0300
committerdartcafe <github@dartcafe.de>2020-04-10 16:22:59 +0300
commit4fca38bd4d2612da9db8c7cd0413d22b2314d8e3 (patch)
treef7c6fcf3da5e860b54c67c5d668dfea44f1ddf7a /lib/Db
parent8611ef7f10052e94c6bd77be53511db0944c0812 (diff)
hide results
Diffstat (limited to 'lib/Db')
-rw-r--r--lib/Db/VoteMapper.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Db/VoteMapper.php b/lib/Db/VoteMapper.php
index 244eaf26..c38d9e4b 100644
--- a/lib/Db/VoteMapper.php
+++ b/lib/Db/VoteMapper.php
@@ -59,6 +59,27 @@ class VoteMapper extends QBMapper {
/**
* @param int $pollId
* @throws \OCP\AppFramework\Db\DoesNotExistException if not found
+ * @return array
+ */
+
+ public function findByPollAndUser($pollId, $userId) {
+ $qb = $this->db->getQueryBuilder();
+
+ $qb->select('*')
+ ->from($this->getTableName())
+ ->where(
+ $qb->expr()->eq('poll_id', $qb->createNamedParameter($pollId, IQueryBuilder::PARAM_INT))
+ )
+ ->andWhere(
+ $qb->expr()->eq('user_id', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR))
+ );
+
+ return $this->findEntities($qb);
+ }
+
+ /**
+ * @param int $pollId
+ * @throws \OCP\AppFramework\Db\DoesNotExistException if not found
* @return Vote
*/