integrate new customer creation form

This commit is contained in:
Manuel Raynaud
2013-09-10 16:13:53 +02:00
parent f8c907d79e
commit eb7bc62964

View File

@@ -26,6 +26,7 @@ use Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\ExecutionContextInterface;
use Thelia\Model\ConfigQuery;
use Thelia\Model\CustomerQuery;
use Thelia\Core\Translation\Translator;
/**
* Class CustomerCreation
@@ -43,55 +44,94 @@ class CustomerCreation extends BaseForm
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "firstname"
"label" => Translator::getInstance()->trans("First Name"),
"label_attr" => array(
"for" => "firstname"
)
))
->add("lastname", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "lastname"
"label" => Translator::getInstance()->trans("Last Name"),
"label_attr" => array(
"for" => "lastname"
)
))
->add("address1", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "address"
"label_attr" => array(
"for" => "address"
),
"label" => Translator::getInstance()->trans("Street Address")
))
->add("address2", "text", array(
"label" => "Address Line 2"
"label" => Translator::getInstance()->trans("Address Line 2"),
"label_attr" => array(
"for" => "address2"
)
))
->add("address3", "text", array(
"label" => "Address Line 3"
"label" => Translator::getInstance()->trans("Address Line 3"),
"label_attr" => array(
"for" => "address3"
)
))
->add("company", "text", array(
"label" => Translator::getInstance()->trans("Company name"),
"label_attr" => array(
"for" => "company"
)
))
->add("phone", "text", array(
"label" => "phone"
"label" => Translator::getInstance()->trans("Phone"),
"label_attr" => array(
"for" => "phone"
)
))
->add("cellphone", "text", array(
"label" => "cellphone"
"label" => Translator::getInstance()->trans("Cellphone"),
"label_attr" => array(
"for" => "cellphone"
)
))
->add("zipcode", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "zipcode"
"label" => Translator::getInstance()->trans("Zip code"),
"label_attr" => array(
"for" => "zipcode"
)
))
->add("city", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "city"
"label" => Translator::getInstance()->trans("City"),
"label_attr" => array(
"for" => "city"
)
))
->add("country", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "country"
"label" => Translator::getInstance()->trans("Country"),
"label_attr" => array(
"for" => "country"
)
))
->add("title", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "title"
"label" => Translator::getInstance()->trans("Title"),
"label_attr" => array(
"for" => "title"
)
))
->add("email", "email", array(
"constraints" => array(
@@ -104,9 +144,12 @@ class CustomerCreation extends BaseForm
)
))
),
"label" => "email"
"label" => Translator::getInstance()->trans("Email Address"),
"label_attr" => array(
"for" => "email"
)
))
->add("email_confirm", "email", array(
/* ->add("email_confirm", "email", array(
"constraints" => array(
new Constraints\Callback(array(
"methods" => array(
@@ -116,13 +159,16 @@ class CustomerCreation extends BaseForm
))
),
"label" => "email confirmation"
))
))*/
->add("password", "password", array(
"constraints" => array(
new Constraints\NotBlank(),
new Constraints\Length(array("min" => ConfigQuery::read("password.length", 4)))
),
"label" => "password"
"label" => Translator::getInstance()->trans("Password"),
"label_attr" => array(
"for" => "password"
)
))
->add("password_confirm", "password", array(
"constraints" => array(
@@ -132,7 +178,10 @@ class CustomerCreation extends BaseForm
array($this, "verifyPasswordField")
)))
),
"label" => "password confirmation"
"label" => "Password confirmation",
"label_attr" => array(
"for" => "password_confirmation"
)
))
;