浏览代码

verify Fixed php-symfony2-stripped's db test

Mike Smith 11 年之前
父节点
当前提交
947c01e442
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      php-symfony2-stripped/src/Skamander/BenchmarkBundle/Controller/BenchController.php

+ 8 - 0
php-symfony2-stripped/src/Skamander/BenchmarkBundle/Controller/BenchController.php

@@ -29,6 +29,10 @@ class BenchController extends Controller
             $worlds[] =  $repo->find(mt_rand(1, 10000));
             $worlds[] =  $repo->find(mt_rand(1, 10000));
         }
         }
 
 
+        if ($queries == 1) {
+            $worlds = $worlds[0];
+        }
+
         return new JsonResponse($worlds);
         return new JsonResponse($worlds);
     }
     }
 
 
@@ -43,6 +47,10 @@ class BenchController extends Controller
         for($i = 0; $i < $queries; ++$i) {
         for($i = 0; $i < $queries; ++$i) {
             $worlds[] =  $conn->fetchAssoc('SELECT * FROM World WHERE id = ?', array(mt_rand(1, 10000)));
             $worlds[] =  $conn->fetchAssoc('SELECT * FROM World WHERE id = ?', array(mt_rand(1, 10000)));
         }
         }
+        
+        if ($queries == 1) {
+            $worlds = $worlds[0];
+        }
 
 
         return new JsonResponse($worlds);
         return new JsonResponse($worlds);
     }
     }