Permalink
Browse files

Fixed validation warnings for CakePHP for single and multi-queries. #…

  • Loading branch information...
ssmith-techempower committed Mar 27, 2015
1 parent 67cf128 commit 1fb88204c6cf2360b5d082e3ce54c59638d1f11b
Showing with 5 additions and 1 deletion.
  1. +5 −1 frameworks/PHP/cakephp/app/Controller/WorldController.php
@@ -37,8 +37,12 @@ public function index() {
// Retrieve a model by ID
// http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#find
$world = $this->World->find('first', array('conditions' => array('id' => $id)));
// Cast numbers to int so they don't get quoted in JSON
$result = $world['World'];
$result['id'] = (int) $result['id'];
$result['randomNumber'] = (int) $result['randomNumber'];
// Store result in array.
$arr[] = array("id" => $world['World']['id'], "randomNumber" => $world['World']['randomNumber']);
$arr[] = array("id" => $result['id'], "randomNumber" => $result['randomNumber']);
}
# Return either one object or a json list

0 comments on commit 1fb8820

Please sign in to comment.