43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php
|
|
namespace OCA\Agency\Db;
|
|
|
|
use OCP\IDBConnection;
|
|
use OCP\AppFramework\Db\QBMapper;
|
|
|
|
class GroupPermissionMapper extends QBMapper {
|
|
|
|
public function __construct(IDBConnection $db) {
|
|
parent::__construct($db, 'grouppermission', GroupPermission::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 findbygid(string $gid) {
|
|
$qb = $this->db->getQueryBuilder();
|
|
|
|
$qb->select('*')
|
|
->from($this->getTableName())
|
|
->where(
|
|
$qb->expr()->eq('gid', $qb->createNamedParameter($gid))
|
|
);
|
|
|
|
return $this->findEntity($qb);
|
|
}
|
|
|
|
public function remove(string $gid) {
|
|
$qb = $this->db->getQueryBuilder();
|
|
$qb->delete($this->getTableName())
|
|
->where($qb->expr()->eq('gid', $qb->createNamedParameter($gid)));
|
|
return $qb->execute();
|
|
}
|
|
} |