Passed
Pull Request — master (#314)
by korelstar
01:56
created

MetaMapper::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
/**
3
 * Nextcloud - Notes
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 */
8
9
namespace OCA\Notes\Db;
10
11
use OCP\IDBConnection;
12
use OCP\AppFramework\Db\QBMapper;
13
use OCP\DB\QueryBuilder\IQueryBuilder;
14
15
class MetaMapper extends QBMapper {
16
17
	public function __construct(IDBConnection $db) {
18
		parent::__construct($db, 'notes_meta');
19
20
	}
21
22
	public function getAll($userId) {
23
		$qb = $this->db->getQueryBuilder();
24
		$qb->select('*')
25
			->from('*PREFIX*notes_meta')
26
			->where(
27
				$qb->expr()->eq('user_id', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR))
28
			);
29
		return $this->findEntities($qb);
30
	}
31
/*
32
	public function get($userId, $fileId) {
33
		$qb = $this->db->getQueryBuilder();
34
		$qb->select('*')
35
			->from('*PREFIX*notes_meta')
36
			->where(
37
				$qb->expr()->and(
38
					$qb->expr()->eq('user_id', $qb->createNamedParameter($userId, IQueryBuilder::PARAM_STR)),
39
					$qb->expr()->eq('file_id', $qb->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))
40
				)
41
42
			);
43
		return $this->findEntity($qb);
44
	}
45
*/
46
}
47