add missing field to customerCreation field

This commit is contained in:
Manuel Raynaud
2013-07-02 14:35:18 +02:00
parent e15c53625e
commit 33aba6b3d5
4 changed files with 71 additions and 11 deletions

View File

@@ -48,6 +48,7 @@ class Customer implements EventSubscriberInterface
$form->bind($request);
if ($form->isValid()) {
echo "ok"; exit;
} else {

View File

@@ -61,12 +61,24 @@ class CustomerCreation extends BaseForm
->add("address3", "text", array(
"label" => "Address Line 3"
))
->add("phone", "text", array(
"label" => "phone"
))
->add("cellphone", "text", array(
"label" => "cellphone"
))
->add("zipcode", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "zipcode"
))
->add("city", "text", array(
"constraints" => array(
new Constraints\NotBlank()
),
"label" => "city"
))
->add("country", "text", array(
"constraints" => array(
new Constraints\NotBlank()
@@ -79,8 +91,8 @@ class CustomerCreation extends BaseForm
new Constraints\Email(),
new Constraints\Callback(array(
"methods" => array(
$this,
"verifyExistingEmail"
array($this,
"verifyExistingEmail")
)
))
),
@@ -90,8 +102,8 @@ class CustomerCreation extends BaseForm
"constraints" => array(
new Constraints\Callback(array(
"methods" => array(
$this,
"verifyEmailField"
array($this,
"verifyEmailField")
)
))
),

View File

@@ -18,5 +18,30 @@ use Thelia\Model\om\BaseCustomer;
*/
class Customer extends BaseCustomer
{
public function create($titleId, $firstname, $lastname, $address1, $address2, $address3, $phone, $cellphone, $zipcode, $countryId, $email, $plainPassword, $reseller = 0, $sponsor = null, $discount = 0 )
{
$this
->setFirstname($firstname)
->setLastname($lastname)
->setAddress1($address1)
->setAddress2($address2)
->setAddress3($address3)
->setPhone($phone)
->setCellphone($cellphone)
->setZipcode($zipcode)
->setCountryId($countryId)
->setEmail($email)
->setPassword($plainPassword)
->setReseller($reseller)
->setSponsor($sponsor)
->setDiscount($discount)
;
}
public function setPassword($password)
{
$this->setAlgo("PASSWORD_BCRYPT");
return parent::setPassword(password_hash($password, PASSWORD_BCRYPT));
}
}