1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Thomas Müller <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @copyright Copyright (c) 2018, ownCloud GmbH |
6
|
|
|
* @license AGPL-3.0 |
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\DAV\JobStatus\Entity; |
23
|
|
|
|
24
|
|
|
use OCP\AppFramework\Db\Mapper; |
25
|
|
|
use OCP\IDBConnection; |
26
|
|
|
|
27
|
|
|
class JobStatusMapper extends Mapper { |
28
|
|
|
public function __construct(IDBConnection $db) { |
29
|
|
|
parent::__construct($db, 'dav_job_status'); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param string $userId |
34
|
|
|
* @param string $jobId |
35
|
|
|
* @return JobStatus |
36
|
|
|
* @throws \OCP\AppFramework\Db\DoesNotExistException |
37
|
|
|
* @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException |
38
|
|
|
*/ |
39
|
|
|
public function findByUserIdAndJobId($userId, $jobId) { |
40
|
|
|
$query = $this->db->getQueryBuilder(); |
41
|
|
|
$query->select('*') |
42
|
|
|
->from($this->getTableName()) |
43
|
|
|
->where($query->expr()->eq('uuid', $query->createNamedParameter($jobId))) |
44
|
|
|
->andWhere($query->expr()->eq('user_id', $query->createNamedParameter($userId))); |
45
|
|
|
return $this->mapRowToEntity($this->findOneQuery($query->getSQL(), $query->getParameters())); |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|