gist/src/Gist/Controller/HomeController.php

41 lines
833 B
PHP
Raw Normal View History

2015-05-05 20:33:05 +02:00
<?php
namespace Gist\Controller;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
2015-05-05 22:04:04 +02:00
use Gist\Form\CreateGistForm;
2015-05-05 20:33:05 +02:00
/**
* Class HomeController
2015-05-05 22:04:04 +02:00
* @author Simon Vieille <simon@deblan.fr>
2015-05-05 20:33:05 +02:00
*/
class HomeController
{
public function indexAction(Request $request, Application $app)
{
2015-05-05 23:24:37 +02:00
$data = array(
'type' => 'xml',
'cipher' => 'no',
);
$form = new CreateGistForm($app['form.factory'], $app['translator'], $data);
2015-05-05 22:06:02 +02:00
$form = $form->build();
2015-05-05 22:04:04 +02:00
2015-05-05 23:24:37 +02:00
if ($request->isMethod('post')) {
$form->submit($request);
if ($form->isValid()) {
}
}
2015-05-05 22:04:04 +02:00
return $app['twig']->render(
'Home/index.html.twig',
array(
'form' => $form->createView(),
)
);
2015-05-05 20:33:05 +02:00
}
}