From 9de3e67e77dd6ad2cffd4d29aae1223fdd7c826c Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 23 Nov 2018 10:04:14 +0100 Subject: [PATCH 1/2] Use the actual query constructed Signed-off-by: Roeland Jago Douma --- lib/Db/MailAccountMapper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Db/MailAccountMapper.php b/lib/Db/MailAccountMapper.php index 90c5d26dc3..4fbe7f4864 100644 --- a/lib/Db/MailAccountMapper.php +++ b/lib/Db/MailAccountMapper.php @@ -51,7 +51,7 @@ public function find($userId, $accountId) { ->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId))) ->andWhere($qb->expr()->eq('id', $qb->createNamedParameter($accountId))); - return $this->findEntity($qb); + return $this->findEntity($query); } /** From 9e228bb3414d8ee1c0fdc8afc62db8371be9f090 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Fri, 23 Nov 2018 10:05:15 +0100 Subject: [PATCH 2/2] Strict + typehinting Signed-off-by: Roeland Jago Douma --- lib/Db/MailAccountMapper.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Db/MailAccountMapper.php b/lib/Db/MailAccountMapper.php index 4fbe7f4864..409aa135d1 100644 --- a/lib/Db/MailAccountMapper.php +++ b/lib/Db/MailAccountMapper.php @@ -1,4 +1,5 @@ @@ -43,7 +44,7 @@ public function __construct(IDBConnection $db) { * * @return MailAccount */ - public function find($userId, $accountId) { + public function find(string $userId, int $accountId): MailAccount { $qb = $this->db->getQueryBuilder(); $query = $qb ->select('*') @@ -58,11 +59,10 @@ public function find($userId, $accountId) { * Finds all Mail Accounts by user id existing for this user * * @param string $userId the id of the user that we want to find - * @param $userId * * @return MailAccount[] */ - public function findByUserId($userId) { + public function findByUserId(string $userId): array { $qb = $this->db->getQueryBuilder(); $query = $qb ->select('*') @@ -79,7 +79,7 @@ public function findByUserId($userId) { * * @return MailAccount */ - public function save(MailAccount $account) { + public function save(MailAccount $account): MailAccount { if (is_null($account->getId())) { return $this->insert($account); } else {