Exemplo n.º 1
0
 public function indexAction()
 {
     $entityManager = App::getContainer()->get('entityManager');
     $postRepository = $entityManager->getRepository("SiteIo\\Model\\Entity\\Post");
     $posts = $postRepository->findAll();
     $formFactory = App::getContainer()->get('formFactory');
     $form = $formFactory->createBuilder()->add('name', TextType::class)->getForm();
     return array('posts' => $posts, 'form' => $form->createView());
 }
Exemplo n.º 2
0
<?php

use App\Singleton\App;
use Symfony\Bridge\Twig\Extension\FormExtension;
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
$viewer = App::getContainer()->get('viewer');
$formEngine = new TwigRendererEngine(array('Twig' . DS . 'form_div_layout.html.twig'));
$twigRenderer = new \Symfony\Bridge\Twig\Form\TwigRenderer($formEngine);
$formExtension = new FormExtension($twigRenderer);
$viewer->addExtensionForTwig($formExtension);
Exemplo n.º 3
0
<?php

use App\Singleton\App;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\ExceptionHandler;
require __DIR__ . '/../config/bootstrap.php';
Debug::enable();
ExceptionHandler::register();
ErrorHandler::register();
$dispatcher = App::getContainer()->get('dispatcher');
$dispatcher->dispatch();
Exemplo n.º 4
0
<?php

/**
 * @codeCoverageIgnore
 */
// @codeCoverageIgnoreStart
use App\Singleton\App;
use Doctrine\ORM\Tools\Setup;
use Symfony\Bridge\Twig\Extension\FormExtension;
$container = App::getContainer();
$container->set('twigLoader', function () {
    return new Twig_Loader_Filesystem();
});
$container->set('twigEnvironment', function () {
    return new Twig_Environment();
});
$container->set('viewer', function () use($container) {
    return new \App\Http\Viewer($container->get('twigLoader'), $container->get('twigEnvironment'));
});
$container->set('dispatcher', function () use($container) {
    return new \App\Http\Dispatcher($container->get('App\\Utility\\Collection'), $container->get('viewer'));
});
$container->set('entityManager', function () {
    $config = Setup::createAnnotationMetadataConfiguration(array(__DIR__ . '/../src/' . APP . '/Model/Entity'), true);
    $connectionParams = array('dbname' => DB_NAME, 'user' => DB_USERNAME, 'password' => DB_PASSWORD, 'host' => DB_HOST, 'driver' => DB_DRIVER);
    $entityManager = \Doctrine\ORM\EntityManager::create($connectionParams, $config);
    return $entityManager;
});
$container->set('formFactory', function () {
    return \Symfony\Component\Form\Forms::createFormFactory();
});
Exemplo n.º 5
0
<?php

require __DIR__ . '/config/bootstrap.php';
$entityManager = \App\Singleton\App::getContainer()->get("entityManager");
return \Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($entityManager);