Completed
Pull Request — master (#95)
by korelstar
05:25
created

MetaMapper::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
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\Mapper;
13
14
class MetaMapper extends Mapper {
15
16
	public function __construct(IDBConnection $db) {
17
		parent::__construct($db, 'notes_meta');
18
	}
19
20
	public function getAll($userId) {
21
		$sql = 'SELECT * FROM `*PREFIX*notes_meta` WHERE user_id=?';
22
		return $this->findEntities($sql, [$userId]);
23
	}
24
25
	public function get($userId, $fileId) {
26
		$sql = 'SELECT * FROM `*PREFIX*notes_meta` WHERE user_id=? AND file_id=?';
27
		return $this->findEntity($sql, [$userId, $fileId]);
28
	}
29
}
30