2023-09-02 02:41:53 +02:00
|
|
|
<?php
|
|
|
|
namespace OCA\GroupfolderFilesystemSnapshots\Db;
|
|
|
|
|
|
|
|
use OCP\IDBConnection;
|
|
|
|
use OCP\AppFramework\Db\QBMapper;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @extends QBMapper<DiffTaskResult>
|
|
|
|
*/
|
|
|
|
class DiffTaskResultMapper extends QBMapper {
|
|
|
|
|
|
|
|
public function __construct(IDBConnection $db) {
|
|
|
|
parent::__construct($db, 'groupfolder_snapshots_task_results', DiffTaskResult::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function find(int $id) {
|
|
|
|
$qb = $this->db->getQueryBuilder();
|
|
|
|
|
|
|
|
$qb->select('*')
|
|
|
|
->from($this->getTableName())
|
|
|
|
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
|
|
|
|
|
|
|
|
return $this->findEntity($qb);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function findAll(int $taskId) {
|
|
|
|
$qb = $this->db->getQueryBuilder();
|
|
|
|
|
|
|
|
$qb->select('*')
|
|
|
|
->from($this->getTableName())
|
|
|
|
->where($qb->expr()->eq('task_id', $qb->createNamedParameter($taskId)));
|
|
|
|
|
|
|
|
return $this->findEntities($qb);
|
|
|
|
}
|
|
|
|
|
2024-01-24 20:22:02 +01:00
|
|
|
public function markReverted(int $id) {
|
|
|
|
$taskResult = $this->find($id);
|
|
|
|
$taskResult->setReverted(True);
|
|
|
|
return $this->update($taskResult);
|
|
|
|
}
|
|
|
|
|
2023-09-02 02:41:53 +02:00
|
|
|
}
|