Files
nextcloud-app-api/lib/Db/ExAppDeployOptionsMapper.php
Andrey Borysenko e27b687ddf feat: Advanced deploy options
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
2025-01-20 19:23:27 +02:00

48 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\AppAPI\Db;
use OCP\AppFramework\Db\QBMapper;
use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
/**
* @template-extends QBMapper<ExAppDeployOption>
*/
class ExAppDeployOptionsMapper extends QBMapper {
public function __construct(IDBConnection $db) {
parent::__construct($db, 'ex_deploy_options');
}
/**
* @throws Exception
*/
public function findAll(): array {
$qb = $this->db->getQueryBuilder();
$result = $qb->select('exs.*')
->from($this->tableName, 'exs')
->executeQuery();
return $result->fetchAll();
}
/**
* @throws Exception
*/
public function removeAllByAppId(string $appId): int {
$qb = $this->db->getQueryBuilder();
$qb->delete($this->tableName)
->where(
$qb->expr()->eq('appid', $qb->createNamedParameter($appId, IQueryBuilder::PARAM_STR))
);
return $qb->executeStatement();
}
}