public function monthAction($slug, $year, $month)
{
$em = $this->getDoctrine()->getManager();
/** @var Journal $journal */
$journal = $em->getRepository('OjsJournalBundle:Journal')->findOneBy(['slug' => $slug]);
$this->throw404IfNotFound($journal);
$months = $this->getMonths();
if (!in_array($month, $months)) {
$this->throw404IfNotFound(null);
}
$monthKey = array_search($month, $months);
$sql = 'SELECT id,doi FROM article WHERE doi is not null AND EXTRACT(YEAR FROM created) =' . $year;
$sql .= 'AND EXTRACT(MONTH FROM created) =' . $monthKey;
$rsm = new ResultSetMapping();
$rsm->addScalarResult('id', 'id');
$rsm->addScalarResult('doi', 'doi');
$rsm->addScalarResult('doi_request_time', 'time');
$query = $em->createNativeQuery($sql, $rsm);
$articles = $query->getResult();
return $this->render('OjsSiteBundle:Lockss:month.html.twig', ['journal' => $journal, 'year' => $year, 'month' => $month, 'articles' => $articles]);
}