Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'Missing explicit access check on entity query.' #52

Merged
merged 1 commit into from
Apr 22, 2022

Conversation

stephen-cox
Copy link
Member

Fixes #51

@@ -70,7 +70,7 @@ function localgov_geo_update_8001() {
*/
function localgov_geo_update_8002(&$sandbox) {
if (!isset($sandbox['total'])) {
$sandbox['total'] = \Drupal::entityQuery('localgov_geo')->count()->execute();
$sandbox['total'] = \Drupal::entityQuery('localgov_geo')->count()->accessCheck(FALSE)->execute();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come we're passing FALSE into accessCheck() here rather than TRUE?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accessCheck(TRUE) will only return results that the current user has permissions to access, as this update should process all Geo entities I don't think the restriction is wanted here

->count()
->accessCheck(TRUE)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing the re-ordering is important here, but not sure why! Could you explain it to me?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a bug in phpstan-drupal - this is now fixed, but this change doesn't change any functionality

@stephen-cox stephen-cox merged commit 2a09b65 into 1.x Apr 22, 2022
@stephen-cox stephen-cox deleted the fix/1.x/51-code-deprecations branch April 22, 2022 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix code depreactions for phpstan 1.x (required for PHP 8.1)
2 participants