Permalink
Browse files

Fixed verification warnings for Slim for single and multi-queries. Re…

…solves #1404
  • Loading branch information...
ssmith-techempower committed Mar 27, 2015
1 parent 67cf128 commit 104009ed781f80b9869e1cfbaad7d52ef9c9b1b8
Showing with 22 additions and 2 deletions.
  1. +1 −1 frameworks/PHP/php-slim/benchmark_config
  2. +21 −1 frameworks/PHP/php-slim/index.php
@@ -5,7 +5,7 @@
"setup_file": "setup",
"json_url": "/json",
"db_url": "/db",
"query_url": "/db?queries=",
"query_url": "/dbs?queries=",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
@@ -43,13 +43,33 @@
});
$app->get('/db', function () use($app) {
$world = R::load('World', mt_rand(1, 10000))->export();
# Cast fields to int so they don't get wrapped with quotes
$world['id'] = (int) $world['id'];
$world['randomNumber'] = (int) $world['randomNumber'];
$app->contentType('application/json');
echo json_encode($world);
});
$app->get('/dbs', function () use($app) {
$queries = ($app->request()->get('queries') !== null)
? $app->request()->get('queries')
: 1;
if ($queries < 1) {
$queries = 1;
}
else if ($queries > 500) {
$queries = 500;
}
$worlds = array();
for ($i = 0; $i < $queries; ++$i) {
$worlds[] = R::load('World', mt_rand(1, 10000))->export();
$world = R::load('World', mt_rand(1, 10000))->export();
# Cast fields to int so they don't get wrapped with quotes
$world['id'] = (int) $world['id'];
$world['randomNumber'] = (int) $world['randomNumber'];
$worlds[] = $world;
}
$app->contentType('application/json');

0 comments on commit 104009e

Please sign in to comment.