You are here

private function WeatherCommands::del in Weather 8

Same name and namespace in other branches
  1. 2.0.x src/Commands/WeatherCommands.php \Drupal\weather\Commands\WeatherCommands::del()

Delete.

File

src/Commands/WeatherCommands.php, line 47

Class

WeatherCommands
Drush command to add support to weather module (import weather csv file).

Namespace

Drupal\weather\Commands

Code

private function del() : self {
  $all = $this
    ->store()
    ->loadByProperties([
    'status' => 'original',
  ]);
  $i = 0;
  $c = count($all);
  foreach ($all as $del) {
    $del
      ->delete();
    if (++$i % 50 === 0) {
      $this
        ->logger()
        ->info("del {$i} / {$c}");
    }
  }
  return $this;
}