Drupal 8 countQuery()

By kenneth, Sun, 12/11/2016 - 20:30
$result = \Drupal::database()->select('node')
  ->condition('type', 'article')
  ->countQuery()
  ->execute()->fetchField();