Exemplo n.º 1
0
<?php

require 'bootstrap.php';
$app = new App\Application();
//Index
$app->get('/', function () use($app) {
    $action = $app->getAction('Index');
    return $action->run();
});
$app->get('/authenticate-twitter', function () use($app) {
    $action = $app->getAction('AuthenticateTwitter');
    return $action->run();
});
$app->get('/authorize-twitter', function () use($app) {
    $action = $app->getAction('AuthorizeTwitter');
    return $action->run();
});
$app->get('/process', function () use($app) {
    $action = $app->getAction('Process');
    return $action->run();
});
$app->get('/result', function () use($app) {
    $action = $app->getAction('Result');
    return $action->run();
});
$app->get('/updateschema', function () use($app) {
    $em = $app->getDoctrineEntityManager();
    $metadatas = $em->getMetadataFactory()->getAllMetadata();
    $tool = new \Doctrine\ORM\Tools\SchemaTool($em);
    $tool->updateSchema($metadatas, true);
});
Exemplo n.º 2
0
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
$parser = new Symfony\Component\Yaml\Yaml();
$global = $parser->parse(dirname(__DIR__) . '/config/global.yml');
$config = $parser->parse(sprintf(dirname(__DIR__) . '/config/%s.yml', $global['environment']));
$security = $parser->parse(dirname(__DIR__) . '/config/security.yml');
$routes = $parser->parse(dirname(__DIR__) . '/config/routes.yml');
$app = new App\Application(array_merge($global, $config, $security, $routes));
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views', 'twig.form.templates' => array('template/layout.html.twig')));
$app->get("/admin", "App\\Controller\\AdminController::index");
/** Doctrine cli-config also uses this bootstrap for db etc, so don't run HTTP stuff if cli is being used **/
isset($cli) ?: $app->run();