refactor how to create Form

This commit is contained in:
Manuel Raynaud
2013-06-28 11:36:35 +02:00
parent 200ace2fc0
commit 995e1eb679
5 changed files with 76 additions and 29 deletions

View File

@@ -25,13 +25,30 @@ namespace Thelia\Action;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Thelia\Core\Event\ActionEvent;
use Thelia\Form\BaseForm;
use Thelia\Form\CustomerCreation;
class Customer implements EventSubscriberInterface
{
public function create(ActionEvent $event)
{
$request = $event->getRequest();
$customerForm = new CustomerCreation($request);
$form = $customerForm->getForm();
if ($request->isMethod("post")) {
$form->bind($request);
if ($form->isValid()) {
echo "ok"; exit;
} else {
echo "ko"; exit;
}
}
}
public function modify(ActionEvent $event)