From 2d0dbb2dd5f42b5bd5d2966b7190a2ccc0a50765 Mon Sep 17 00:00:00 2001 From: Andy Foster Date: Wed, 8 Nov 2023 11:29:26 -0500 Subject: [PATCH] Add access check to entity queries In drupal 10, if you don't explicitly set access check to true or false, it throws a deprecation error. This should probably have been set to FALSE anyway. (The previous, default behaviour was TRUE). --- composer.json | 5 +++++ src/EventDownloadService.php | 3 +++ 2 files changed, 8 insertions(+) diff --git a/composer.json b/composer.json index 2abcf1f..b10f719 100644 --- a/composer.json +++ b/composer.json @@ -58,5 +58,10 @@ "./vendor/bin/phpcs --standard=Drupal --ignore=*.md,vendor --extensions=php,module,inc,install,test,profile,theme,css,info .", "./vendor/bin/phpcpd --names='*.module,*.inc,*.test,*.php' --exclude=vendor ." ] + }, + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } } } diff --git a/src/EventDownloadService.php b/src/EventDownloadService.php index 36e41fe..4f84f56 100644 --- a/src/EventDownloadService.php +++ b/src/EventDownloadService.php @@ -109,6 +109,7 @@ public function libcalEventToNode(array $events) public function queryEventNode($event_id) { $query = \Drupal::entityQuery('node'); + $query->accessCheck(FALSE); $query->condition('status', 1); $query->condition('type', 'event'); $query->condition('field_libcal_id', $event_id); @@ -136,6 +137,7 @@ public function updatePastFieldEventNode($config) // Begin constructing the query // All event types with a start date in the past $query = \Drupal::entityQuery('node'); + $query->accessCheck(FALSE); $query->condition('type', 'event'); $query->condition('field_start_date', $now, '<'); @@ -178,6 +180,7 @@ public function deleteEventNodes($events) { // Get all future events $query = \Drupal::entityQuery('node'); + $query->accessCheck(FALSE); $query->condition('type', 'event'); $query->condition('field_start_date', $now, '>='); $nids = $query->execute();