Open
Description
Bug report
When an EntityQuery::accessCheck()
call is chained with other methods it is not detected.
This is similar to #437 but possibly requires a different fix.
Code snippet that reproduces the problem
This yields a Relying on entity queries to check access by default is deprecated
error:
$storage = \Drupal::entityTypeManager()->getStorage('node');
$query = $storage->getQuery();
$query
->accessCheck(FALSE)
->condition('field_myfield', TRUE);
$entity_ids = $query->execute();
The ordering doesn't matter, if the accessCheck()
is last, the error still occurs:
$storage = \Drupal::entityTypeManager()->getStorage('node');
$query = $storage->getQuery();
$query
->condition('field_myfield', TRUE)
->accessCheck(FALSE);
$entity_ids = $query->execute();
When the calls are not chained, the rule works correctly. This does not yield an error:
$storage = \Drupal::entityTypeManager()->getStorage('node');
$query = $storage->getQuery();
$query->accessCheck(FALSE);
$query->condition('field_myfield', TRUE);
$entity_ids = $query->execute();