Skip to content

Commit

Permalink
MAGETWO-83257: #4004: Newsletter Subscriber create-date not set, and …
Browse files Browse the repository at this point in the history
…change_status_at broken #11879

 - fixed backward compatibility issue
  • Loading branch information
Oleksii Korshenko committed Nov 6, 2017
1 parent 8fcee2c commit 60a698d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/code/Magento/Newsletter/Model/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

use Magento\Customer\Api\AccountManagementInterface;
use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\MailException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Stdlib\DateTime\DateTime;

/**
* Subscriber model
Expand Down Expand Up @@ -96,7 +98,7 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel

/**
* Date
* @var \Magento\Framework\Stdlib\DateTime\DateTime
* @var DateTime
*/
private $dateTime;

Expand Down Expand Up @@ -137,13 +139,13 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel
* @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Customer\Model\Session $customerSession
* @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
* @param CustomerRepositoryInterface $customerRepository
* @param AccountManagementInterface $customerAccountManagement
* @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data
* @param DateTime|null $dateTime
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
Expand All @@ -154,23 +156,23 @@ public function __construct(
\Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Customer\Model\Session $customerSession,
\Magento\Framework\Stdlib\DateTime\DateTime $dateTime,
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 = []
array $data = [],
DateTime $dateTime = null
) {
$this->_newsletterData = $newsletterData;
$this->_scopeConfig = $scopeConfig;
$this->_transportBuilder = $transportBuilder;
$this->_storeManager = $storeManager;
$this->_customerSession = $customerSession;
$this->dateTime = $dateTime;
$this->customerRepository = $customerRepository;
$this->customerAccountManagement = $customerAccountManagement;
$this->inlineTranslation = $inlineTranslation;
$this->dateTime = $dateTime ?: ObjectManager::getInstance()->get(DateTime::class);
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}

Expand Down

0 comments on commit 60a698d

Please sign in to comment.