From bbd89215d89adc9499b178ce22d310b88ae0a703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 9 Jan 2014 09:56:46 +0100 Subject: [PATCH] [fix] getEntryById now returns an array with one element --- app/controllers/front.php | 2 +- src/Poche/Repository/EntryRepository.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/front.php b/app/controllers/front.php index 4c0bf04..6bacdc2 100644 --- a/app/controllers/front.php +++ b/app/controllers/front.php @@ -15,7 +15,7 @@ $front->get('/view/{id}', function (Request $request, $id) use ($app) { $entry = $app['entry_api']->getEntryById($id); - return $app['twig']->render('view.twig', array('entry' => $entry)); + return $app['twig']->render('view.twig', array('entry' => $entry[0])); }) ->bind('view_entry'); diff --git a/src/Poche/Repository/EntryRepository.php b/src/Poche/Repository/EntryRepository.php index 747b727..da0418b 100644 --- a/src/Poche/Repository/EntryRepository.php +++ b/src/Poche/Repository/EntryRepository.php @@ -29,7 +29,7 @@ class EntryRepository $sql = "SELECT * FROM entries where id = ? AND user_id = ?"; $entry = $this->db->fetchAll($sql, array($id, $userId)); - return $entry ? $entry[0] : array(); + return $entry ? $entry : array(); } }