public function onJournalView(ViewJournalEvent $event)
{
$journal = $event->getJournal();
$stat = $this->em->getRepository('OjsAnalyticsBundle:JournalStatistic')->findOneBy(['date' => new \DateTime(), 'journal' => $journal]);
if (!$stat) {
$stat = new JournalStatistic();
$stat->setDate(new \DateTime());
$stat->setJournal($journal);
$stat->setView(1);
} else {
$stat->setView($stat->getView() + 1);
}
$journal->increaseViewCount();
$this->em->persist($journal);
$this->em->persist($stat);
$this->em->flush();
}