21 class Customer extends \Magento\Eav\Model\Entity\VersionControl\AbstractEntity
48 private $notificationStorage;
71 $this->_scopeConfig = $scopeConfig;
72 $this->_validatorFactory = $validatorFactory;
108 $customer->setStoreId($this->storeManager->getStore()->getId());
115 throw new ValidatorException(
__(
'The customer email is missing. Enter and try again.'));
119 $bind = [
'email' =>
$customer->getEmail()];
127 if ($customer->getSharingConfig()->isWebsiteScope()) {
128 $bind[
'website_id'] = (int)
$customer->getWebsiteId();
129 $select->where(
'website_id = :website_id');
132 $bind[
'entity_id'] = (int)
$customer->getId();
133 $select->where(
'entity_id != :entity_id');
138 throw new AlreadyExistsException(
139 __(
'A customer with the same email address already exists in an associated website.')
168 $validator = $this->_validatorFactory->createValidator(
'customer',
'save');
171 throw new ValidatorException(
174 $validator->getMessages()
184 private function getNotificationStorage()
186 if ($this->notificationStorage ===
null) {
189 return $this->notificationStorage;
200 $this->getNotificationStorage()->add(
216 $select = parent::_getLoadRowSelect($object, $rowId);
217 if ($object->getWebsiteId() && $object->getSharingConfig()->isWebsiteScope()) {
218 $select->where(
'website_id =?', (
int)$object->getWebsiteId());
235 $bind = [
'customer_email' =>
$email];
240 'email = :customer_email' 243 if ($customer->getSharingConfig()->isWebsiteScope()) {
245 throw new \Magento\Framework\Exception\LocalizedException(
246 __(
"A customer website ID wasn't specified. The ID must be specified to use the website scope.")
249 $bind[
'website_id'] = (int)
$customer->getWebsiteId();
250 $select->where(
'website_id = :website_id');
286 [
'email',
'cnt' =>
'COUNT(*)']
295 if (empty($lookup)) {
298 return $lookup[
'cnt'] > 1;
315 'entity_id = :entity_id' 341 'entity_id = :entity_id' 355 if ($this->_scopeConfig->getValue(
360 parent::setNewIncrementId($object);
376 if (is_string($passwordLinkToken) && !empty($passwordLinkToken)) {
377 $customer->setRpToken($passwordLinkToken);
const DATETIME_PHP_FORMAT
loadByEmail(\Magento\Customer\Model\Customer $customer, $email)
getWebsiteId($customerId)
elseif(isset( $params[ 'redirect_parent']))
changeResetPasswordLinkToken(\Magento\Customer\Model\Customer $customer, $passwordLinkToken)
load($object, $entityId, $attributes=[])
changePassword(\Magento\Customer\Model\Customer $customer, $newPassword)
_afterSave(\Magento\Framework\DataObject $customer)
const XML_PATH_GENERATE_HUMAN_FRIENDLY_ID
setConnection($connection)
_getLoadRowSelect($object, $rowId)
_beforeSave(DataObject $object)
const UPDATE_CUSTOMER_SESSION
__construct(\Magento\Eav\Model\Entity\Context $context, \Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot $entitySnapshot, \Magento\Framework\Model\ResourceModel\Db\VersionControl\RelationComposite $entityRelationComposite, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Validator\Factory $validatorFactory, \Magento\Framework\Stdlib\DateTime $dateTime, \Magento\Store\Model\StoreManagerInterface $storeManager, $data=[])
checkCustomerId($customerId)
setNewIncrementId(\Magento\Framework\DataObject $object)