37 lines
1,004 B
PHP
37 lines
1,004 B
PHP
|
<?php
|
||
|
namespace OCA\GroupfolderFilesystemSnapshots\Db;
|
||
|
|
||
|
use OCP\IDBConnection;
|
||
|
use OCP\AppFramework\Db\QBMapper;
|
||
|
|
||
|
/**
|
||
|
* @extends QBMapper<DiffTask>
|
||
|
*/
|
||
|
class DiffTaskMapper extends QBMapper {
|
||
|
|
||
|
public function __construct(IDBConnection $db) {
|
||
|
parent::__construct($db, 'groupfolder_snapshots_tasks', DiffTask::class);
|
||
|
}
|
||
|
|
||
|
public function find(int $id, string $userId) {
|
||
|
$qb = $this->db->getQueryBuilder();
|
||
|
|
||
|
$qb->select('*')
|
||
|
->from($this->getTableName())
|
||
|
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)))
|
||
|
->andWhere($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
|
||
|
|
||
|
return $this->findEntity($qb);
|
||
|
}
|
||
|
|
||
|
public function findAll(string $userId) {
|
||
|
$qb = $this->db->getQueryBuilder();
|
||
|
|
||
|
$qb->select('*')
|
||
|
->from($this->getTableName())
|
||
|
->where($qb->expr()->eq('user_id', $qb->createNamedParameter($userId)));
|
||
|
|
||
|
return $this->findEntities($qb);
|
||
|
}
|
||
|
|
||
|
}
|