$paths = array("/path/to/entity-files");
$isDevMode = false;
// the connection configuration
$dbParams = array(
'driver' => 'pdo_mysql',
'user' => 'root',
'password' => '',
'dbname' => 'foo',
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);
bin/console server:start --env=prod
Running this server in production environment is NOT recommended!
$formFactory = Forms::createFormFactory();
$form = $formFactory->createBuilder()->getForm();
$this->twig->addExtension(new FormExtension());
return $this->renderView('create-article.twig', ['form' => $form]);
$twig = new Environment(new FilesystemLoader([
$viewsDirectory,
$vendorTwigBridgeDirectory.'/Resources/views/Form',
]));
$formEngine = new TwigRendererEngine([$defaultFormTheme], $twig);
$twig->addRuntimeLoader(new FactoryRuntimeLoader([
FormRenderer::class => function () use ($formEngine, $csrfManager) {
return new FormRenderer($formEngine, $csrfManager);
},
]));
$twig->addExtension(new FormExtension());
$formFactory = Forms::createFormFactoryBuilder()->getFormFactory()->createBuilder()->getForm();
return $this->renderView('create-article.twig', ['form' => $form]);