/** * Gets a log file * * @param $id The line of the cron in the cron table * @param $type The type of file, log or error * @return \Symfony\Component\HttpFoundation\Response */ public function fileAction($id, $type) { $cm = new CronManager(); $crons = $cm->get(); $cron = $crons[$id]; $data = array(); $data['file'] = $type == 'log' ? $cron->getLogFile() : $cron->getErrorFile(); $data['content'] = \file_get_contents($data['file']); $serializer = new Serializer(array(), array('json' => new JsonEncoder())); return new Response($serializer->serialize($data, 'json')); }