<commit_before><?php

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

use Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider;
use Silex\Provider\DoctrineServiceProvider;

error_reporting(-1);

$loader = require_once __DIR__.'/../vendor/autoload.php';

\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

$app = new Silex\Application();

$dbh = new PDO('mysql:host=192.168.100.102;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
    PDO::ATTR_PERSISTENT => true
));

$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
    'db.options' => array(
    'pdo' => $dbh
    ),
));

$app->register(new DoctrineOrmServiceProvider, array(
    'orm.proxies_dir' => __DIR__.'/../proxies', // Not sure how or if this needs handling...
    'orm.em.options' => array(
        'mappings' => array(
            array(
                'type' => 'annotation',
                'namespace' => 'Entity',
                'path' => __DIR__.'/../src/Entity',
                'use_simple_annotation_reader' => false,
            ),
        ),
        'metadata_cache' => 'redis'
    ),
));

$app->get('/json', function() {
    return new JsonResponse(array('message' => 'Hello, World!'));
});

$app->get('/db', function(Request $request) use ($app) {
    $queries = $request->query->getInt('queries', 1);<commit_msg>removes header caching that was breaking silex-orm tests<commit_after><?php

use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

use Dflydev\Silex\Provider\DoctrineOrm\DoctrineOrmServiceProvider;
use Silex\Provider\DoctrineServiceProvider;

error_reporting(-1);

$loader = require_once __DIR__.'/../vendor/autoload.php';

\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

$app = new Silex\Application();

$dbh = new PDO('mysql:host=127.0.0.1;dbname=hello_world', 'benchmarkdbuser', 'benchmarkdbpass', array(
    PDO::ATTR_PERSISTENT => true
));

$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
    'db.options' => array(
    'pdo' => $dbh
    ),
));

$app->register(new DoctrineOrmServiceProvider, array(
    'orm.proxies_dir' => __DIR__.'/../proxies', // Not sure how or if this needs handling...
    'orm.em.options' => array(
        'mappings' => array(
            array(
                'type' => 'annotation',
                'namespace' => 'Entity',
                'path' => __DIR__.'/../src/Entity',
                'use_simple_annotation_reader' => false,
            ),
        )
    ),
));

$app->get('/json', function() {
    return new JsonResponse(array('message' => 'Hello, World!'));
});

$app->get('/db', function(Request $request) use ($app) {
    $queries = $request->query->getInt('queries', 1);
{'fraction_non_alphanumeric': 0.17296918767507002, 'fraction_numerical': 0.007703081232492998, 'mean_word_length': 3.492138364779874, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '115414', 'n_tokens_mistral': 942, 'n_tokens_neox': 921, 'n_words': 156}