diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-03 15:28:31 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-01-08 11:45:19 +0100 |
commit | 8b64e92b9262d2a2eec6345685ce421050f95c66 (patch) | |
tree | dd51490b8a184b2643414d11867a9fa450aa5065 /apps/workflowengine/lib | |
parent | 84e6e9f7cf19207041925eaa237d24e1c12c2c2d (diff) | |
download | nextcloud-server-8b64e92b9262d2a2eec6345685ce421050f95c66.tar.gz nextcloud-server-8b64e92b9262d2a2eec6345685ce421050f95c66.zip |
Bump doctrine/dbal from 2.12.0 to 3.0.0
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/workflowengine/lib')
3 files changed, 19 insertions, 17 deletions
diff --git a/apps/workflowengine/lib/Controller/AWorkflowController.php b/apps/workflowengine/lib/Controller/AWorkflowController.php index 6d109f7dccf..8b0d35ef62e 100644 --- a/apps/workflowengine/lib/Controller/AWorkflowController.php +++ b/apps/workflowengine/lib/Controller/AWorkflowController.php @@ -25,7 +25,7 @@ declare(strict_types=1); namespace OCA\WorkflowEngine\Controller; -use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\Exception; use OCA\WorkflowEngine\Helper\ScopeContext; use OCA\WorkflowEngine\Manager; use OCP\AppFramework\Http\DataResponse; @@ -112,7 +112,7 @@ abstract class AWorkflowController extends OCSController { throw new OCSBadRequestException($e->getMessage(), $e); } catch (\DomainException $e) { throw new OCSForbiddenException($e->getMessage(), $e); - } catch (DBALException $e) { + } catch (Exception $e) { throw new OCSException('An internal error occurred', $e->getCode(), $e); } } @@ -139,7 +139,7 @@ abstract class AWorkflowController extends OCSController { throw new OCSBadRequestException($e->getMessage(), $e); } catch (\DomainException $e) { throw new OCSForbiddenException($e->getMessage(), $e); - } catch (DBALException $e) { + } catch (Exception $e) { throw new OCSException('An internal error occurred', $e->getCode(), $e); } } @@ -157,7 +157,7 @@ abstract class AWorkflowController extends OCSController { throw new OCSBadRequestException($e->getMessage(), $e); } catch (\DomainException $e) { throw new OCSForbiddenException($e->getMessage(), $e); - } catch (DBALException $e) { + } catch (Exception $e) { throw new OCSException('An internal error occurred', $e->getCode(), $e); } } diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index 87c3c5de6b3..8c37e4d9885 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -21,7 +21,7 @@ namespace OCA\WorkflowEngine; -use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\Exception; use OC\Cache\CappedMemoryCache; use OCA\WorkflowEngine\AppInfo\Application; use OCA\WorkflowEngine\Check\FileMimeType; @@ -290,7 +290,7 @@ class Manager implements IManager { * @param string $operation * @return array The added operation * @throws \UnexpectedValueException - * @throws DBALException + * @throw Exception */ public function addOperation( string $class, @@ -315,7 +315,7 @@ class Manager implements IManager { $this->addScope($id, $scope); $this->connection->commit(); - } catch (DBALException $e) { + } catch (Exception $e) { $this->connection->rollBack(); throw $e; } @@ -342,7 +342,7 @@ class Manager implements IManager { $result = $qb->execute(); $this->operationsByScope[$scopeContext->getHash()] = []; - while ($opId = $result->fetchColumn(0)) { + while ($opId = $result->fetchOne()) { $this->operationsByScope[$scopeContext->getHash()][] = (int)$opId; } $result->closeCursor(); @@ -358,7 +358,7 @@ class Manager implements IManager { * @return array The updated operation * @throws \UnexpectedValueException * @throws \DomainException - * @throws DBALException + * @throws Exception */ public function updateOperation( int $id, @@ -392,7 +392,7 @@ class Manager implements IManager { ->where($query->expr()->eq('id', $query->createNamedParameter($id))); $query->execute(); $this->connection->commit(); - } catch (DBALException $e) { + } catch (Exception $e) { $this->connection->rollBack(); throw $e; } @@ -405,7 +405,7 @@ class Manager implements IManager { * @param int $id * @return bool * @throws \UnexpectedValueException - * @throws DBALException + * @throws Exception * @throws \DomainException */ public function deleteOperation($id, ScopeContext $scopeContext) { @@ -425,7 +425,7 @@ class Manager implements IManager { ->execute(); } $this->connection->commit(); - } catch (DBALException $e) { + } catch (Exception $e) { $this->connection->rollBack(); throw $e; } diff --git a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php index 50b38f81993..290dae4c67a 100644 --- a/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php +++ b/apps/workflowengine/lib/Migration/PopulateNewlyIntroducedDatabaseFields.php @@ -25,7 +25,7 @@ declare(strict_types=1); namespace OCA\WorkflowEngine\Migration; -use Doctrine\DBAL\Driver\Statement; +use OCP\DB\IResult; use OCP\IDBConnection; use OCP\Migration\IOutput; use OCP\Migration\IRepairStep; @@ -52,17 +52,17 @@ class PopulateNewlyIntroducedDatabaseFields implements IRepairStep { $result->closeCursor(); } - protected function populateScopeTable(Statement $ids): void { + protected function populateScopeTable(IResult $ids): void { $qb = $this->dbc->getQueryBuilder(); $insertQuery = $qb->insert('flow_operations_scope'); - while ($id = $ids->fetchColumn(0)) { + while ($id = $ids->fetchOne()) { $insertQuery->values(['operation_id' => $qb->createNamedParameter($id), 'type' => IManager::SCOPE_ADMIN]); $insertQuery->execute(); } } - protected function getIdsWithoutScope(): Statement { + protected function getIdsWithoutScope(): IResult { $qb = $this->dbc->getQueryBuilder(); $selectQuery = $qb->select('o.id') ->from('flow_operations', 'o') @@ -71,6 +71,8 @@ class PopulateNewlyIntroducedDatabaseFields implements IRepairStep { // The left join operation is not necessary, usually, but it's a safe-guard // in case the repair step is executed multiple times for whatever reason. - return $selectQuery->execute(); + /** @var IResult $result */ + $result = $selectQuery->execute(); + return $result; } } |