Code Duplication    Length = 7-8 lines in 3 locations

lib/private/User/AccountMapper.php 1 location

@@ 127-134 (lines=8) @@
124
	 * @throws MultipleObjectsReturnedException if more than one account exists
125
	 * @return Account
126
	 */
127
	public function getByUid($uid) {
128
		$qb = $this->db->getQueryBuilder();
129
		$qb->select('*')
130
			->from($this->getTableName())
131
			->where($qb->expr()->eq('lower_user_id', $qb->createNamedParameter(\strtolower($uid))));
132
133
		return $this->findEntity($qb->getSQL(), $qb->getParameters());
134
	}
135
136
	/**
137
	 * @param string $fieldName

lib/private/User/AccountTermMapper.php 1 location

@@ 66-73 (lines=8) @@
63
	 * @param $account_id
64
	 * @return AccountTerm[] of account search terms
65
	 */
66
	public function findByAccountId($account_id) {
67
		$qb = $this->db->getQueryBuilder();
68
		$qb->select('term')
69
			->from($this->getTableName())
70
			->where($qb->expr()->eq('account_id', $qb->createNamedParameter($account_id)));
71
72
		return $this->findEntities($qb->getSQL(), $qb->getParameters());
73
	}
74
}
75

apps/files/lib/Service/TransferOwnership/TransferRequestMapper.php 1 location

@@ 22-28 (lines=7) @@
19
	 * @throws \OCP\AppFramework\Db\DoesNotExistException
20
	 * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
21
	 */
22
	public function findById($requestId) {
23
		$query = $this->db->getQueryBuilder();
24
		$query->select('*')
25
			->from($this->getTableName())
26
			->where($query->expr()->eq('id', $query->expr()->literal($requestId)));
27
		return $this->findEntity($query->getSQL(), $query->getParameters());
28
	}
29
30
	/**
31
	 * Finds a pending transfer for the same file between two users