#!/usr/bin/env php get('db'); $scheduleIds = array_map(fn(stdClass $schedule) => $schedule->id, $db->select('SELECT id FROM schedules')); } $importer = $app->get(ImportSchedule::class); foreach ($scheduleIds as $id) { try { $importer->doImport($id); } catch (ErrorException $e) { echo "import '$id' failed:" . PHP_EOL . $e->getMessage() . PHP_EOL; } }