I am getting custom entity nodes using entity queries like below:

  $query= $this->entity_query->get('order_entity')
      ->condition('external_id', $data['external_id']);

  $order_nids2 = $query->execute();

I am trying to put a condition where I can get nodes which do not belong to a particular user role. How can achieve this?

  • Welcome to Drupal Answers! What do you mean by custom entity nodes? If it's a custom entity, it's not a node; if it's a node, it's not a custom entity. – kiamlaluno Mar 16 '18 at 8:03

Nodes are only associated with author's nids (not user roles)

Thus you should do a query first to get the userids that match your selected user roles. Then use that array to filter out nodes with authors that belong to those user ids.

Not the answer you're looking for? Browse other questions tagged or ask your own question.