'Hello World!')); } /** * @Route("/db", name="_db") * * Used db?queries={queries} instead of db/{queries} to align the test with most of the other tests */ public function dbAction(Request $request) { $queries = $request->query->getInt('queries', 1); // possibility for enhancement is the use of SplFixedArray -> http://php.net/manual/de/class.splfixedarray.php $worlds = array(); $repo = $this->getDoctrine() ->getRepository('SkamanderBenchmarkBundle:World'); for($i = 0; $i < $queries; ++$i) { $worlds[] = $repo->find(mt_rand(1, 10000)); } return new JsonResponse($worlds); } }