|
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Data Fields | |
| const | STATUS_SUBSCRIBED = 1 |
| const | STATUS_NOT_ACTIVE = 2 |
| const | STATUS_UNSUBSCRIBED = 3 |
| const | STATUS_UNCONFIRMED = 4 |
| const | XML_PATH_CONFIRM_EMAIL_TEMPLATE = 'newsletter/subscription/confirm_email_template' |
| const | XML_PATH_CONFIRM_EMAIL_IDENTITY = 'newsletter/subscription/confirm_email_identity' |
| const | XML_PATH_SUCCESS_EMAIL_TEMPLATE = 'newsletter/subscription/success_email_template' |
| const | XML_PATH_SUCCESS_EMAIL_IDENTITY = 'newsletter/subscription/success_email_identity' |
| const | XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE = 'newsletter/subscription/un_email_template' |
| const | XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY = 'newsletter/subscription/un_email_identity' |
| const | XML_PATH_CONFIRMATION_FLAG = 'newsletter/subscription/confirm' |
| const | XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG = 'newsletter/subscription/allow_guest_subscribe' |
Protected Member Functions | |
| _construct () | |
| _updateCustomerSubscription ($customerId, $subscribe) | |
Protected Member Functions inherited from AbstractModel | |
| _construct () | |
| _init ($resourceModel) | |
| _setResourceModel ($resourceName, $collectionName=null) | |
| _getResource () | |
| _getEventData () | |
| _beforeLoad ($modelId, $field=null) | |
| _afterLoad () | |
| _hasModelChanged () | |
| _getValidatorBeforeSave () | |
| _createValidatorBeforeSave () | |
| _getValidationRulesBeforeSave () | |
| _clearReferences () | |
| _clearData () | |
Protected Member Functions inherited from DataObject | |
| _getData ($key) | |
| _underscore ($name) | |
Protected Attributes | |
| $_eventPrefix = 'newsletter_subscriber' | |
| $_eventObject = 'subscriber' | |
| $_isStatusChanged = false | |
| $_newsletterData = null | |
| $_scopeConfig | |
| $_customerSession | |
| $_storeManager | |
| $customerRepository | |
| $customerAccountManagement | |
| $_transportBuilder | |
| $inlineTranslation | |
Protected Attributes inherited from AbstractModel | |
| $_eventPrefix = 'core_abstract' | |
| $_eventObject = 'object' | |
| $_idFieldName = 'id' | |
| $_hasDataChanges = false | |
| $_origData | |
| $_isDeleted = false | |
| $_resource | |
| $_resourceCollection | |
| $_resourceName | |
| $_collectionName | |
| $_cacheTag = false | |
| $_dataSaveAllowed = true | |
| $_isObjectNew = null | |
| $_validatorBeforeSave = null | |
| $_eventManager | |
| $_cacheManager | |
| $_registry | |
| $_logger | |
| $_appState | |
| $_actionValidator | |
| $storedData = [] | |
Protected Attributes inherited from DataObject | |
| $_data = [] | |
Additional Inherited Members | |
Static Protected Attributes inherited from DataObject | |
| static | $_underscoreCache = [] |
Subscriber model
@method int getStoreId() @method $this setStoreId(int $value) @method string getChangeStatusAt() @method $this setChangeStatusAt(string $value) @method int getCustomerId() @method $this setCustomerId(int $value) @method string getSubscriberEmail() @method $this setSubscriberEmail(string $value) @method int getSubscriberStatus() @method $this setSubscriberStatus(int $value) @method string getSubscriberConfirmCode() @method $this setSubscriberConfirmCode(string $value) @method int getSubscriberId() @method Subscriber setSubscriberId(int $value)
@SuppressWarnings(PHPMD.CouplingBetweenObjects) @SuppressWarnings(PHPMD.CyclomaticComplexity)
@api
Definition at line 40 of file Subscriber.php.
| __construct | ( | \Magento\Framework\Model\Context | $context, |
| \Magento\Framework\Registry | $registry, | ||
| \Magento\Newsletter\Helper\Data | $newsletterData, | ||
| \Magento\Framework\App\Config\ScopeConfigInterface | $scopeConfig, | ||
| \Magento\Framework\Mail\Template\TransportBuilder | $transportBuilder, | ||
| \Magento\Store\Model\StoreManagerInterface | $storeManager, | ||
| \Magento\Customer\Model\Session | $customerSession, | ||
| CustomerRepositoryInterface | $customerRepository, | ||
| AccountManagementInterface | $customerAccountManagement, | ||
| \Magento\Framework\Translate\Inline\StateInterface | $inlineTranslation, | ||
| \Magento\Framework\Model\ResourceModel\AbstractResource | $resource = null, |
||
| \Magento\Framework\Data\Collection\AbstractDb | $resourceCollection = null, |
||
| array | $data = [], |
||
| \Magento\Framework\Stdlib\DateTime\DateTime | $dateTime = null, |
||
| CustomerInterfaceFactory | $customerFactory = null, |
||
| DataObjectHelper | $dataObjectHelper = null |
||
| ) |
Initialize dependencies.
| \Magento\Framework\Model\Context | $context | |
| \Magento\Framework\Registry | $registry | |
| \Magento\Newsletter\Helper\Data | $newsletterData | |
| \Magento\Framework\App\Config\ScopeConfigInterface | $scopeConfig | |
| \Magento\Framework\Mail\Template\TransportBuilder | $transportBuilder | |
| \Magento\Store\Model\StoreManagerInterface | $storeManager | |
| \Magento\Customer\Model\Session | $customerSession | |
| CustomerRepositoryInterface | $customerRepository | |
| AccountManagementInterface | $customerAccountManagement | |
| \Magento\Framework\Translate\Inline\StateInterface | $inlineTranslation | |
| \Magento\Framework\Model\ResourceModel\AbstractResource | null | $resource | |
| \Magento\Framework\Data\Collection\AbstractDb | null | $resourceCollection | |
| array | $data | |
| \Magento\Framework\Stdlib\DateTime\DateTime | null | $dateTime | |
| CustomerInterfaceFactory | null | $customerFactory | |
| DataObjectHelper | null | $dataObjectHelper | @SuppressWarnings(PHPMD.ExcessiveParameterList) |
Definition at line 164 of file Subscriber.php.
|
protected |
|
protected |
Saving customer subscription status
| int | $customerId | |
| bool | $subscribe | indicates whether the customer should be subscribed or unsubscribed |
@SuppressWarnings(PHPMD.CyclomaticComplexity) @SuppressWarnings(PHPMD.NPathComplexity)
If subscription status has been changed then send email to the customer
Definition at line 564 of file Subscriber.php.
| beforeSave | ( | ) |
Set date of last changed status
Definition at line 864 of file Subscriber.php.
| confirm | ( | $code | ) |
Confirms subscriber newsletter
| string | $code |
Definition at line 660 of file Subscriber.php.
| getCode | ( | ) |
| getConfirmationLink | ( | ) |
Return link for confirmation of subscription
Definition at line 246 of file Subscriber.php.
| getEmail | ( | ) |
| getId | ( | ) |
| getStatus | ( | ) |
| getSubscriberFullName | ( | ) |
Retrieve Subscribers Full Name if it was set
Definition at line 849 of file Subscriber.php.
| getUnsubscriptionLink | ( | ) |
| isStatusChanged | ( | ) |
| isSubscribed | ( | ) |
| loadByCustomerId | ( | $customerId | ) |
Load subscriber info by customerId
| int | $customerId |
Definition at line 390 of file Subscriber.php.
| randomSequence | ( | $length = 32 | ) |
Returns string of random chars
| int | $length |
Definition at line 413 of file Subscriber.php.
| received | ( | \Magento\Newsletter\Model\Queue | $queue | ) |
Mark receiving subscriber of queue newsletter
| \Magento\Newsletter\Model\Queue | $queue |
Definition at line 680 of file Subscriber.php.
| sendConfirmationRequestEmail | ( | ) |
| sendConfirmationSuccessEmail | ( | ) |
| sendUnsubscriptionEmail | ( | ) |
| setCode | ( | $value | ) |
Alias for setSubscriberConfirmCode()
| string | $value |
Definition at line 267 of file Subscriber.php.
| setEmail | ( | $value | ) |
Alias for setSubscriberEmail()
| string | $value |
Definition at line 321 of file Subscriber.php.
| setId | ( | $value | ) |
Alias for setSubscriberId()
| int | $value |
Definition at line 226 of file Subscriber.php.
| setMessagesScope | ( | $scope | ) |
Set the error messages scope for subscription
| boolean | $scope |
Definition at line 299 of file Subscriber.php.
| setStatus | ( | $value | ) |
Alias for setSubscriberStatus()
| int | $value |
Definition at line 288 of file Subscriber.php.
| setStatusChanged | ( | $value | ) |
Set for status change flag
| boolean | $value |
Definition at line 332 of file Subscriber.php.
| subscribe | ( | ) |
Subscribes by email
| string |
Definition at line 437 of file Subscriber.php.
| subscribeCustomerById | ( | $customerId | ) |
Subscribe the customer with the id provided
| int | $customerId |
Definition at line 525 of file Subscriber.php.
| unsubscribe | ( | ) |
Unsubscribes loaded subscription
Definition at line 504 of file Subscriber.php.
| unsubscribeCustomerById | ( | $customerId | ) |
Unsubscribe the customer with the id provided
| int | $customerId |
Definition at line 536 of file Subscriber.php.
| updateSubscription | ( | $customerId | ) |
Update the subscription based on latest information of associated customer.
| int | $customerId |
Definition at line 547 of file Subscriber.php.
|
protected |
Definition at line 98 of file Subscriber.php.
|
protected |
Definition at line 70 of file Subscriber.php.
|
protected |
Definition at line 61 of file Subscriber.php.
|
protected |
Definition at line 77 of file Subscriber.php.
|
protected |
Definition at line 84 of file Subscriber.php.
|
protected |
Definition at line 91 of file Subscriber.php.
|
protected |
Definition at line 111 of file Subscriber.php.
|
protected |
Definition at line 126 of file Subscriber.php.
|
protected |
Definition at line 121 of file Subscriber.php.
|
protected |
Definition at line 116 of file Subscriber.php.
|
protected |
Definition at line 131 of file Subscriber.php.
| const STATUS_NOT_ACTIVE = 2 |
Definition at line 43 of file Subscriber.php.
| const STATUS_SUBSCRIBED = 1 |
Definition at line 42 of file Subscriber.php.
| const STATUS_UNCONFIRMED = 4 |
Definition at line 45 of file Subscriber.php.
| const STATUS_UNSUBSCRIBED = 3 |
Definition at line 44 of file Subscriber.php.
| const XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG = 'newsletter/subscription/allow_guest_subscribe' |
Definition at line 54 of file Subscriber.php.
| const XML_PATH_CONFIRM_EMAIL_IDENTITY = 'newsletter/subscription/confirm_email_identity' |
Definition at line 48 of file Subscriber.php.
| const XML_PATH_CONFIRM_EMAIL_TEMPLATE = 'newsletter/subscription/confirm_email_template' |
Definition at line 47 of file Subscriber.php.
| const XML_PATH_CONFIRMATION_FLAG = 'newsletter/subscription/confirm' |
Definition at line 53 of file Subscriber.php.
| const XML_PATH_SUCCESS_EMAIL_IDENTITY = 'newsletter/subscription/success_email_identity' |
Definition at line 50 of file Subscriber.php.
| const XML_PATH_SUCCESS_EMAIL_TEMPLATE = 'newsletter/subscription/success_email_template' |
Definition at line 49 of file Subscriber.php.
| const XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY = 'newsletter/subscription/un_email_identity' |
Definition at line 52 of file Subscriber.php.
| const XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE = 'newsletter/subscription/un_email_template' |
Definition at line 51 of file Subscriber.php.