Skip to content

Instantly share code, notes, and snippets.

@parap
Created March 22, 2013 08:22

Revisions

  1. parap created this gist Mar 22, 2013.
    29 changes: 29 additions & 0 deletions index.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    <?php

    use Symfony\Component\HttpFoundation\Request;
    use frontend\model\Initializer;

    include_once('config.php');
    include_once('lib/autoload.php');
    include_once('app/bootstrap.php');

    $initializer = new Initializer();
    $initializer->kernel();
    $initializer->doctrine();

    $kernel = $initializer->getKernel();
    $request = Request::createFromGlobals();

    try {
    $repo = $initializer->getEntityManager()->getRepository('frontend\model\entity\User');
    $results = $repo->findAll();
    var_dump($results);

    $response = $kernel->handle($request);
    $response->send();

    $kernel->terminate($request, $response);
    } catch (Exception $e) {
    //TODO: improve 404 handle
    echo '404: ' . $e->getMessage();
    }