From 9b275019fff3ecd1e06b03e474004a41b19c2618 Mon Sep 17 00:00:00 2001 From: Luciano Righetti Date: Tue, 6 Feb 2024 14:36:06 +0100 Subject: [PATCH] fix: invalid statements --- src/Model/Table/EventBlocklistsTable.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Model/Table/EventBlocklistsTable.php b/src/Model/Table/EventBlocklistsTable.php index 16c0c8635..384d90e50 100644 --- a/src/Model/Table/EventBlocklistsTable.php +++ b/src/Model/Table/EventBlocklistsTable.php @@ -54,13 +54,17 @@ class EventBlocklistsTable extends AppTable */ public function removeBlockedEvents(array &$eventArray) { + if (empty($eventArray)) { + return; + } + // When event array contains a lot events, it is more efficient to fetch all blocked events - $conditions = (count($eventArray) > 10000) ? [] : ['EventBlocklist.event_uuid IN' => array_column($eventArray, 'uuid')]; + $conditions = (count($eventArray) > 10000) ? [] : ['event_uuid IN' => array_column($eventArray, 'uuid')]; $blocklistHits = $this->find( 'column', [ 'conditions' => $conditions, - 'fields' => ['EventBlocklist.event_uuid'], + 'fields' => ['event_uuid'], ] ); if (empty($blocklistHits)) {