mirror of
https://github.com/nextcloud/server.git
synced 2026-06-16 12:10:35 -04:00
This patch introduces an entity and a mapper for Invites Signed-off-by: Micke Nordin <kano@sunet.se>
40 lines
989 B
PHP
40 lines
989 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCA\CloudFederationAPI\Db;
|
|
|
|
use OCP\AppFramework\Db\QBMapper;
|
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
|
use OCP\IDBConnection;
|
|
|
|
/**
|
|
* @template-extends QBMapper<FederatedInvite>
|
|
*/
|
|
class FederatedInviteMapper extends QBMapper {
|
|
public const TABLE_NAME = 'federated_invites';
|
|
|
|
public function __construct(IDBConnection $db) {
|
|
parent::__construct($db, self::TABLE_NAME);
|
|
}
|
|
public function findByToken(string $token): ?FederatedInvite {
|
|
/** @var IQueryBuilder $qb */
|
|
if (!$token) {
|
|
return null;
|
|
}
|
|
$qb = $this->db->getQueryBuilder();
|
|
$qb->select('*')
|
|
->from('federated_invites')
|
|
->where($qb->expr()->eq('token', $qb->createNamedParameter($token)));
|
|
return $this->findEntity($qb);
|
|
}
|
|
|
|
public function dataArrayToInvite(array $data): FederatedInvite {
|
|
return $this->mapRowToEntity($data);
|
|
}
|
|
}
|