Code Duplication    Length = 23-23 lines in 2 locations

lib/Db/FileMapper.php 1 location

@@ 22-44 (lines=23) @@
19
 * 
20
 * @package OCA\Ocr\Db
21
 */
22
class FileMapper extends Mapper {
23
24
    /**
25
     * FileMapper constructor.
26
     * ATTENTION: the common methods like 'delete' 'update' and things like that will not work because we join and
27
     * cleanup some columns!!!
28
     * 
29
     * @param IDBConnection $db            
30
     */
31
    public function __construct(IDBConnection $db) {
32
        parent::__construct($db, 'filecache', 'OCA\Ocr\Db\File');
33
    }
34
35
    /**
36
     * Find a specific file entity
37
     * 
38
     * @param
39
     *            $fileid
40
     * @return File
41
     */
42
    public function find($fileid) {
43
        $sql = 'SELECT f.fileid AS fileid, f.path AS path, f.name as name, m.mimetype AS mimetype, s.id AS storagename FROM *PREFIX*filecache AS f, *PREFIX*mimetypes AS m, *PREFIX*storages AS s WHERE f.fileid = ? AND f.mimetype = m.id AND f.storage = s.numeric_id';
44
        return $this->findEntity($sql, [
45
                $fileid
46
        ]);
47
    }

lib/Db/ShareMapper.php 1 location

@@ 22-44 (lines=23) @@
19
 * 
20
 * @package OCA\Ocr\Db
21
 */
22
class ShareMapper extends Mapper {
23
24
    /**
25
     * ShareMapper constructor.
26
     * 
27
     * @param IDBConnection $db            
28
     */
29
    public function __construct(IDBConnection $db) {
30
        parent::__construct($db, 'share', 'OCA\Ocr\Db\Share');
31
    }
32
33
    /**
34
     * Find the right name for a shared file
35
     * 
36
     * @param integer $fileid            
37
     * @param string $shareWith            
38
     * @param string $owner            
39
     * @return Share
40
     */
41
    public function find($fileid, $shareWith, $owner) {
42
        $sql = 'SELECT file_target FROM *PREFIX*share WHERE file_source = ? AND share_with = ? AND uid_owner = ?';
43
        return $this->findEntity($sql, [
44
                $fileid,
45
                $shareWith,
46
                $owner
47
        ]);