setCustomerTitleId($titleId) ->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) ; if(!is_null($lang)) { $this->setLang($lang); } $this->save(); } public function preInsert(\PropelPDO $con = null) { $customerRef = new CustomRefEvent($this); if (!is_null($this->dispatcher)) { $this->dispatcher->dispatch(TheliaEvents::CREATECUSTOMER_CUSTOMREF, $customerRef); } $this->setRef($customerRef->hasRef()? $customerRef->getRef() : $this->generateRef()); return true; } protected function generateRef() { return date("YmdHI"); } public function setPassword($password) { \Thelia\Log\Tlog::getInstance()->debug($password); if ($this->isNew() && ($password === null || trim($password) == "")) { throw new InvalidArgumentException("customer password is mandatory on creation"); } if($password !== null && trim($password) != "") { $this->setAlgo("PASSWORD_BCRYPT"); return parent::setPassword(password_hash($password, PASSWORD_BCRYPT)); } } public function setDispatcher(EventDispatcherInterface $dispatcher) { $this->dispatcher = $dispatcher; } }