diff options
Diffstat (limited to 'apps/workflowengine/lib/Manager.php')
-rw-r--r-- | apps/workflowengine/lib/Manager.php | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index 8cd52f4cd64..0f41679789d 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -99,7 +100,7 @@ class Manager implements IManager { ->where($query->expr()->neq('events', $query->createNamedParameter('[]'), IQueryBuilder::PARAM_STR)) ->groupBy('class', 'entity', $query->expr()->castColumn('events', IQueryBuilder::PARAM_STR)); - $result = $query->execute(); + $result = $query->executeQuery(); $operations = []; while ($row = $result->fetch()) { $eventNames = \json_decode($row['events']); @@ -145,13 +146,13 @@ class Manager implements IManager { ->where($query->expr()->eq('o.class', $query->createParameter('operationClass'))); $query->setParameters(['operationClass' => $operationClass]); - $result = $query->execute(); + $result = $query->executeQuery(); $scopesByOperation[$operationClass] = []; while ($row = $result->fetch()) { $scope = new ScopeContext($row['type'], $row['value']); - if (!$operation->isAvailableForScope((int) $row['type'])) { + if (!$operation->isAvailableForScope((int)$row['type'])) { continue; } @@ -180,7 +181,7 @@ class Manager implements IManager { } $query->setParameters(['scope' => $scopeContext->getScope(), 'scopeId' => $scopeContext->getScopeId()]); - $result = $query->execute(); + $result = $query->executeQuery(); $this->operations[$scopeContext->getHash()] = []; while ($row = $result->fetch()) { @@ -191,7 +192,7 @@ class Manager implements IManager { continue; } - if (!$operation->isAvailableForScope((int) $row['scope_type'])) { + if (!$operation->isAvailableForScope((int)$row['scope_type'])) { continue; } @@ -221,7 +222,7 @@ class Manager implements IManager { $query->select('*') ->from('flow_operations') ->where($query->expr()->eq('id', $query->createNamedParameter($id))); - $result = $query->execute(); + $result = $query->executeQuery(); $row = $result->fetch(); $result->closeCursor(); @@ -238,7 +239,7 @@ class Manager implements IManager { array $checkIds, string $operation, string $entity, - array $events + array $events, ): int { $query = $this->connection->getQueryBuilder(); $query->insert('flow_operations') @@ -250,7 +251,7 @@ class Manager implements IManager { 'entity' => $query->createNamedParameter($entity), 'events' => $query->createNamedParameter(json_encode($events)) ]); - $query->execute(); + $query->executeStatement(); $this->cacheFactory->createDistributed('flow')->remove('events'); @@ -264,7 +265,7 @@ class Manager implements IManager { * @param string $operation * @return array The added operation * @throws \UnexpectedValueException - * @throw Exception + * @throws Exception */ public function addOperation( string $class, @@ -273,7 +274,7 @@ class Manager implements IManager { string $operation, ScopeContext $scope, string $entity, - array $events + array $events, ) { $this->validateOperation($class, $name, $checks, $operation, $scope, $entity, $events); @@ -313,7 +314,7 @@ class Manager implements IManager { } $qb->setParameters(['scope' => $scopeContext->getScope(), 'scopeId' => $scopeContext->getScopeId()]); - $result = $qb->execute(); + $result = $qb->executeQuery(); $operations = []; while (($opId = $result->fetchOne()) !== false) { @@ -342,7 +343,7 @@ class Manager implements IManager { string $operation, ScopeContext $scopeContext, string $entity, - array $events + array $events, ): array { if (!$this->canModify($id, $scopeContext)) { throw new \DomainException('Target operation not within scope'); @@ -393,12 +394,12 @@ class Manager implements IManager { $this->connection->beginTransaction(); $result = (bool)$query->delete('flow_operations') ->where($query->expr()->eq('id', $query->createNamedParameter($id))) - ->execute(); + ->executeStatement(); if ($result) { $qb = $this->connection->getQueryBuilder(); $result &= (bool)$qb->delete('flow_operations_scope') ->where($qb->expr()->eq('operation_id', $qb->createNamedParameter($id))) - ->execute(); + ->executeStatement(); } $this->connection->commit(); } catch (Exception $e) { @@ -537,11 +538,11 @@ class Manager implements IManager { $query->select('*') ->from('flow_checks') ->where($query->expr()->in('id', $query->createNamedParameter($checkIds, IQueryBuilder::PARAM_INT_ARRAY))); - $result = $query->execute(); + $result = $query->executeQuery(); while ($row = $result->fetch()) { - $this->checks[(int) $row['id']] = $row; - $checks[(int) $row['id']] = $row; + $this->checks[(int)$row['id']] = $row; + $checks[(int)$row['id']] = $row; } $result->closeCursor(); @@ -568,11 +569,11 @@ class Manager implements IManager { $query->select('id') ->from('flow_checks') ->where($query->expr()->eq('hash', $query->createNamedParameter($hash))); - $result = $query->execute(); + $result = $query->executeQuery(); if ($row = $result->fetch()) { $result->closeCursor(); - return (int) $row['id']; + return (int)$row['id']; } $query = $this->connection->getQueryBuilder(); @@ -583,7 +584,7 @@ class Manager implements IManager { 'value' => $query->createNamedParameter($value), 'hash' => $query->createNamedParameter($hash), ]); - $query->execute(); + $query->executeStatement(); return $query->getLastInsertId(); } @@ -597,7 +598,7 @@ class Manager implements IManager { 'type' => $query->createNamedParameter($scope->getScope()), 'value' => $query->createNamedParameter($scope->getScopeId()), ]); - $insertQuery->execute(); + $insertQuery->executeStatement(); } public function formatOperation(array $operation): array { |