diff -u b/core/modules/node/lib/Drupal/node/NodeGrantStorageController.php b/core/modules/node/lib/Drupal/node/NodeGrantStorageController.php --- b/core/modules/node/lib/Drupal/node/NodeGrantStorageController.php +++ b/core/modules/node/lib/Drupal/node/NodeGrantStorageController.php @@ -77,21 +77,21 @@ // Only interested for granting in the current operation. $query->condition('grant_' . $operation, 1, '>='); // Check for grants for this node and the correct langcode. - $nids = db_and() + $nids = $query->conditionGroupFactory() ->condition('nid', $node->id()) ->condition('langcode', $langcode); // If the node is published, also take the default grant into account. The // default is saved with a node ID of 0. $status = $node instanceof EntityNG ? $node->status : $node->get('status', $langcode)->value; if ($status) { - $nids = db_or() + $nids = $query->conditionGroupFactory('OR') ->condition($nids) ->condition('nid', 0); } $query->condition($nids); $query->range(0, 1); - $grants = db_or(); + $grants = $query->conditionGroupFactory('OR'); foreach (node_access_grants($operation, $account instanceof User ? $account->getBCEntity() : $account) as $realm => $gids) { foreach ($gids as $gid) { $grants->condition(db_and() only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Query/ConditionInterface.php +++ b/core/lib/Drupal/Core/Database/Query/ConditionInterface.php @@ -156,4 +156,12 @@ public function compile(Connection $connection, PlaceholderInterface $queryPlace * TRUE if the condition has been previously compiled. */ public function compiled(); + + /** + * Returns an AND / OR condition group object. + * + * @param string $conjunction + * @return Condition + */ + public function conditionGroupFactory($conjunction = 'AND'); } only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Query/Query.php +++ b/core/lib/Drupal/Core/Database/Query/Query.php @@ -177,4 +177,12 @@ public function comment($comment) { public function &getComments() { return $this->comments; } + + /** + * {@inheritdoc} + */ + public function conditionGroupFactory($conjunction = 'AND') { + return new Condition($conjunction); + } + }