/** * Execute the console command. * * @return void */ public function fire() { if (!$this->confirmTruncate()) { throw new RuntimeException('Truncate aborted.'); } $tables = array('geonames_names', 'geonames_alternate_names', 'geonames_countries', 'geonames_language_codes', 'geonames_admin_divisions', 'geonames_admin_subdivisions', 'geonames_hierarchies', 'geonames_features', 'geonames_timezones', 'geonames_continents'); foreach ($tables as $table) { $this->repository->truncate($table); $this->line("<info>Truncated:</info> {$table}"); } }
/** * Prevent wrong executons of the importer. * * @param string $table * @return void */ protected function isEmpty($table) { if (!$this->repository->isEmpty($table)) { throw new RuntimeException("The table [{$table}] is not empty."); } }