Dec 21, 2020 in Drupal 8

A typical example of querying is getting the row count. This snippet shows you how.

    $query = \Drupal::entityQuery('node')
      ->condition('type', 'page')
      ->condition('user_id', $user_id);
    $count = $query->count()->execute();

 

Comments