Completed
Pull Request — master (#490)
by
unknown
01:54
created

FilePropertiesMapper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A find() 0 5 1
A findAll() 0 4 1
1
<?php
2
namespace OCA\Gallery\Db;
3
4
use OCP\IDBConnection;
5
use OCP\AppFramework\Db\Mapper;
6
7
class FilePropertiesMapper extends Mapper {
8
9
    public function __construct(IDBConnection $db) {
10
        parent::__construct($db, 'gallery_file_properties');
11
    }
12
13
    /**
14
     * @throws \OCP\AppFramework\Db\DoesNotExistException if not found
15
     * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException if more than one result
16
     */
17
    public function find($id) {
18
        $sql = 'SELECT * FROM `*PREFIX*gallery_file_properties` ' .
19
            'WHERE `id` = ?';
20
        return $this->findEntity($sql, [$id]);
21
    }
22
23
    public function findAll($limit=null, $offset=null) {
24
        $sql = 'SELECT * FROM `*PREFIX*gallery_file_properties`';
25
        return $this->findEntities($sql, $limit, $offset);
26
    }
27
}
28