You are here

public function DeleteContent::getEntityIds in Drush Delete All 8.2

Same name and namespace in other branches
  1. 3.x src/DeleteContent.php \Drupal\drush_delete\DeleteContent::getEntityIds()
1 call to DeleteContent::getEntityIds()
DeleteContent::deleteAllEntityType in src/DeleteContent.php
Function that provides the deleteing content functionality

File

src/DeleteContent.php, line 42

Class

DeleteContent

Namespace

Drupal\drush_delete

Code

public function getEntityIds($type) {
  $nids = array();
  $connection = \Drupal::database();
  $result = $connection
    ->select('node', 'n')
    ->fields('n', array(
    'nid',
  ))
    ->condition('type', $type, '=')
    ->execute()
    ->fetchall();
  if (empty($result)) {
    return NULL;
  }
  else {
    foreach ($result as $item) {
      $nids[] = $item->nid;
    }
  }
  return $nids;
}