diff --git a/src/Controller/Component/FloodProtectionComponent.php b/src/Controller/Component/FloodProtectionComponent.php index 91668b6..fe632ad 100644 --- a/src/Controller/Component/FloodProtectionComponent.php +++ b/src/Controller/Component/FloodProtectionComponent.php @@ -34,7 +34,7 @@ class FloodProtectionComponent extends Component public function check(string $action, int $limit = 5, int $expiration_time = 300): bool { - $results = $this->FloodProtections->find('all')->where(['request_action' => $action, 'remote_ip' => $this->remote_ip, 'expiration' > time()])->toList(); + $results = $this->FloodProtections->find()->where(['request_action' => $action, 'remote_ip' => $this->remote_ip, 'expiration' > time()])->all()->toList(); if (count($results) >= $limit) { throw new TooManyRequestsException(__('Too many {0} requests have been issued ({1} requests allowed ever {2} seconds)', [$action, $limit, $expiration_time])); } diff --git a/src/Model/Table/AppTable.php b/src/Model/Table/AppTable.php index 2de0b1d..527d290 100644 --- a/src/Model/Table/AppTable.php +++ b/src/Model/Table/AppTable.php @@ -47,7 +47,7 @@ class AppTable extends Table ->limit($options['limit']) ->page(1) ->enableHydration(false); - $topUsage = $queryTopUsage->toList(); + $topUsage = $queryTopUsage->all()->toList(); $stats[$scope] = $topUsage; if ( !empty($options['includeOthers']) && !empty($topUsage) &&