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

@@ 41-47 (lines=7) @@
38
	 * @throws \OCP\AppFramework\Db\DoesNotExistException
39
	 * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException
40
	 */
41
	public function findById($requestId) {
42
		$query = $this->db->getQueryBuilder();
43
		$query->select('*')
44
			->from($this->getTableName())
45
			->where($query->expr()->eq('id', $query->expr()->literal($requestId)));
46
		return $this->findEntity($query->getSQL(), $query->getParameters());
47
	}
48
49
	/**
50
	 * Finds a pending transfer for the same file between two users