本文整理汇总了PHP中Magento\Customer\Model\Customer::getEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::getEmail方法的具体用法?PHP Customer::getEmail怎么用?PHP Customer::getEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Customer\Model\Customer
的用法示例。
在下文中一共展示了Customer::getEmail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: push
/**
* Replace existing customer model with a new one.
*
* @param Customer $customer
* @return $this
*/
public function push(Customer $customer)
{
$this->customerRegistryById[$customer->getId()] = $customer;
$emailKey = $this->getEmailKey($customer->getEmail(), $customer->getWebsiteId());
$this->customerRegistryByEmail[$emailKey] = $customer;
return $this;
}
示例2: validate
/**
* Validate customer attribute values.
*
* @param CustomerModel $customerModel
* @throws InputException
* @return void
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
private function validate(CustomerModel $customerModel)
{
$exception = new InputException();
if (!\Zend_Validate::is(trim($customerModel->getFirstname()), 'NotEmpty')) {
$exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'firstname']);
}
if (!\Zend_Validate::is(trim($customerModel->getLastname()), 'NotEmpty')) {
$exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'lastname']);
}
if (!\Zend_Validate::is($customerModel->getEmail(), 'EmailAddress')) {
$exception->addError(InputException::INVALID_FIELD_VALUE, ['fieldName' => 'email', 'value' => $customerModel->getEmail()]);
}
$dob = $this->getAttributeMetadata('dob');
if (!is_null($dob) && $dob->isRequired() && '' == trim($customerModel->getDob())) {
$exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'dob']);
}
$taxvat = $this->getAttributeMetadata('taxvat');
if (!is_null($taxvat) && $taxvat->isRequired() && '' == trim($customerModel->getTaxvat())) {
$exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'taxvat']);
}
$gender = $this->getAttributeMetadata('gender');
if (!is_null($gender) && $gender->isRequired() && '' == trim($customerModel->getGender())) {
$exception->addError(InputException::REQUIRED_FIELD, ['fieldName' => 'gender']);
}
if ($exception->wasErrorAdded()) {
throw $exception;
}
}