From: Cameron Ball Date: Mon, 27 Oct 2014 15:59:51 +0000 (+0800) Subject: Fix issues with simfile controller. X-Git-Url: http://git.cameron1729.xyz/?p=rock.divinelegy.git;a=commitdiff_plain;h=0010072494871c54c3444b1113127555172affd0 Fix issues with simfile controller. --- diff --git a/Controllers/SimfileController.php b/Controllers/SimfileController.php index 84bdfdf..b56cb4a 100644 --- a/Controllers/SimfileController.php +++ b/Controllers/SimfileController.php @@ -40,7 +40,10 @@ class SimfileController implements IDivineController foreach($simfiles as $simfile) { - $returnArray[$simfile->getTitle()] = array('artist' => $simfile->getArtist()->getName()); + $returnArray[] = array( + 'artist' => $simfile->getArtist()->getName(), + 'title' => $simfile->getTitle() + ); } $this->_response->setHeader('Content-Type', 'application/json') diff --git a/DataAccess/StepMania/SimfileRepository.php b/DataAccess/StepMania/SimfileRepository.php index 87e6eaf..a4a1f16 100644 --- a/DataAccess/StepMania/SimfileRepository.php +++ b/DataAccess/StepMania/SimfileRepository.php @@ -21,18 +21,18 @@ class SimfileRepository implements ISimfileRepository } public function findById($id) { - return $this->_dataMapper->map( - 'Simfile', - 'SELECT * FROM %s WHERE id=' . $id - ); + $queryBuilder = $this->_queryBuilderFactory->createInstance(); + $queryBuilder->where('id', '=', $id); + + return $this->_dataMapper->map('Simfile', $queryBuilder); } public function findRange($id, $limit) { - return $this->_dataMapper->findRange( - 'Simfile', - 'SELECT * FROM %s WHERE id>=' . $id . ' LIMIT ' . $limit - ); + $queryBuilder = $this->_queryBuilderFactory->createInstance(); + $queryBuilder->where('id', '>=', $id)->limit($limit); + + return $this->_dataMapper->map('Simfile', $queryBuilder); } public function save(ISimfile $entity) {