From 008cb18b8f68f207fc965dd8c0cc129feab60d58 Mon Sep 17 00:00:00 2001 From: Cameron Ball Date: Thu, 19 Feb 2015 14:04:02 +0800 Subject: [PATCH] Bugfix --- DataAccess/FileRepository.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/DataAccess/FileRepository.php b/DataAccess/FileRepository.php index 74d44b3..74cb212 100644 --- a/DataAccess/FileRepository.php +++ b/DataAccess/FileRepository.php @@ -56,8 +56,16 @@ class FileRepository implements IFileRepository 'File', $queryBuilder ); - - return reset($results); + + //XXX: Hack. Sometimes instead of getting a real array back we get the + //lazyload thing because I was an idiot with the database. Originally + //I simply did return reset($results) but if we don't have an array that + //won't work. So instead do a foreach (lazyload thing is iterable) and just + //return the first element. + foreach($results as $result) + { + return $result; + } } public function save(\Domain\Entities\IFile $file) { -- 2.11.0