Completed
Pull Request — master (#1523)
by
unknown
08:27
created

AliasMapper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 3
Bugs 0 Features 2
Metric Value
wmc 3
c 3
b 0
f 2
lcom 0
cbo 0
dl 0
loc 23
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A find() 0 4 1
A findAll() 0 4 1
1
<?php
2
3
/**
4
 * ownCloud - Mail
5
 *
6
 * This file is licensed under the Affero General Public License version 3 or
7
 * later. See the COPYING file.
8
 *
9
 * @author Tahaa Karim <[email protected]>
10
 * @copyright Tahaa Karim 2016
11
 */
12
13
namespace OCA\Mail\Db;
14
15
use OCP\AppFramework\Db\Mapper;
16
use OCP\IDb;
17
18
class AliasMapper extends Mapper {
19
20
	/**
21
	 * @param IDb $db
22
	 */
23
	public function __construct(IDb $db) {
24
		parent::__construct($db, 'mail_aliases');
25
	}
26
27
	/*
28
	 *  TODO: Add function for CRUD by user id and email
29
	 */
30
31
	public function find($id) {
32
		$sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE id = ?';
33
		return $this->findEntity($sql, [$id]);
34
	}
35
36
	public function findAll($accountId) {
37
		$sql = 'SELECT * FROM ' . $this->getTableName() . ' WHERE account_id = ?';
38
		return $this->findEntities($sql, [$accountId]);
39
	}
40
}
41