7
7
8
8
use Magento \Customer \Api \AccountManagementInterface ;
9
9
use Magento \Customer \Api \CustomerRepositoryInterface ;
10
+ use Magento \Framework \App \ObjectManager ;
10
11
use Magento \Framework \Exception \MailException ;
11
12
use Magento \Framework \Exception \NoSuchEntityException ;
13
+ use Magento \Framework \Stdlib \DateTime \DateTime ;
12
14
13
15
/**
14
16
* Subscriber model
@@ -96,7 +98,7 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel
96
98
97
99
/**
98
100
* Date
99
- * @var \Magento\Framework\Stdlib\DateTime\ DateTime
101
+ * @var DateTime
100
102
*/
101
103
private $ dateTime ;
102
104
@@ -137,13 +139,13 @@ class Subscriber extends \Magento\Framework\Model\AbstractModel
137
139
* @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder
138
140
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
139
141
* @param \Magento\Customer\Model\Session $customerSession
140
- * @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
141
142
* @param CustomerRepositoryInterface $customerRepository
142
143
* @param AccountManagementInterface $customerAccountManagement
143
144
* @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
144
- * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
145
- * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
145
+ * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
146
+ * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
146
147
* @param array $data
148
+ * @param DateTime|null $dateTime
147
149
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
148
150
*/
149
151
public function __construct (
@@ -154,23 +156,23 @@ public function __construct(
154
156
\Magento \Framework \Mail \Template \TransportBuilder $ transportBuilder ,
155
157
\Magento \Store \Model \StoreManagerInterface $ storeManager ,
156
158
\Magento \Customer \Model \Session $ customerSession ,
157
- \Magento \Framework \Stdlib \DateTime \DateTime $ dateTime ,
158
159
CustomerRepositoryInterface $ customerRepository ,
159
160
AccountManagementInterface $ customerAccountManagement ,
160
161
\Magento \Framework \Translate \Inline \StateInterface $ inlineTranslation ,
161
162
\Magento \Framework \Model \ResourceModel \AbstractResource $ resource = null ,
162
163
\Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
163
- array $ data = []
164
+ array $ data = [],
165
+ DateTime $ dateTime = null
164
166
) {
165
167
$ this ->_newsletterData = $ newsletterData ;
166
168
$ this ->_scopeConfig = $ scopeConfig ;
167
169
$ this ->_transportBuilder = $ transportBuilder ;
168
170
$ this ->_storeManager = $ storeManager ;
169
171
$ this ->_customerSession = $ customerSession ;
170
- $ this ->dateTime = $ dateTime ;
171
172
$ this ->customerRepository = $ customerRepository ;
172
173
$ this ->customerAccountManagement = $ customerAccountManagement ;
173
174
$ this ->inlineTranslation = $ inlineTranslation ;
175
+ $ this ->dateTime = $ dateTime ?: ObjectManager::getInstance ()->get (DateTime::class);
174
176
parent ::__construct ($ context , $ registry , $ resource , $ resourceCollection , $ data );
175
177
}
176
178
0 commit comments