Completed
Pull Request — master (#1591)
by Christoph
23:04
created

LocalattAchmentMapper::find()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
/**
4
 * @author Christoph Wurst <[email protected]>
5
 *
6
 * ownCloud - Mail
7
 *
8
 * This code is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License, version 3,
10
 * as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License, version 3,
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
19
 *
20
 */
21
22
namespace OCA\Mail\Db;
23
24
use OCP\AppFramework\Db\Mapper;
25
use OCP\IDb;
26
27
class LocalattAchmentMapper extends Mapper {
28
29
	/**
30
	 * @param IDb $db
31
	 */
32
	public function __construct(IDb $db) {
33
		parent::__construct($db, 'mail_attachments');
34
	}
35
36
	/**
37
	 * @param string $userId
38
	 * @param int $id
39
	 * @return LocalAttachment[]
40
	 */
41
	public function find($userId, $id) {
42
		$sql = 'SELECT * FROM `' . $this->getTableName() . '` WHERE user_id = ? and id = ?';
43
		$params = [$userId, $id];
44
45
		return $this->findEntity($sql, $params);
46
	}
47
48
}
49