public function upsertCronPostAction() { $id = $_POST['id'] ?? null; unset($_POST['id']); $cron = $id ? $this->cronsTable->get($id)->set($_POST) : $this->cronsTable->newEntity($_POST); if ($cron->dirty()) { try { $this->cronsTable->save($cron); $this->flasher->success("Success!"); } catch (\Exception $e) { $this->flasher->error('Something went wrong while ' . ($cron->id ? 'updating' : 'creating') . ' the cron - ' . $e->getMessage()); } } $this->redirect('/admin/crons'); }