@@ -53,12 +53,12 @@ protected function _construct()
53
53
54
54
/**
55
55
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
56
- * @param Attribute $attribute
57
- * @param Manager $sequenceManager
58
56
* @param Snapshot $entitySnapshot
59
57
* @param RelationComposite $entityRelationComposite
58
+ * @param Attribute $attribute
59
+ * @param Manager $sequenceManager
60
60
* @param StateHandler $stateHandler
61
- * @param string $connectionName
61
+ * @param string|null $connectionName
62
62
*/
63
63
public function __construct (
64
64
\Magento \Framework \Model \ResourceModel \Db \Context $ context ,
@@ -137,6 +137,8 @@ protected function calculateItems(\Magento\Sales\Model\Order $object)
137
137
}
138
138
139
139
/**
140
+ * Before save
141
+ *
140
142
* @param \Magento\Framework\Model\AbstractModel $object
141
143
* @return $this
142
144
*/
@@ -152,15 +154,15 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
152
154
];
153
155
$ object ->setStoreName (implode (PHP_EOL , $ name ));
154
156
$ object ->setTotalItemCount ($ this ->calculateItems ($ object ));
157
+ $ object ->setData (
158
+ 'protect_code ' ,
159
+ substr (
160
+ hash ('sha256 ' , uniqid (Random::getRandomNumber (), true ) . ': ' . microtime (true )),
161
+ 5 ,
162
+ 32
163
+ )
164
+ );
155
165
}
156
- $ object ->setData (
157
- 'protect_code ' ,
158
- substr (
159
- hash ('sha256 ' , uniqid (Random::getRandomNumber (), true ) . ': ' . microtime (true )),
160
- 5 ,
161
- 32
162
- )
163
- );
164
166
$ isNewCustomer = !$ object ->getCustomerId () || $ object ->getCustomerId () === true ;
165
167
if ($ isNewCustomer && $ object ->getCustomer ()) {
166
168
$ object ->setCustomerId ($ object ->getCustomer ()->getId ());
@@ -169,7 +171,7 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
169
171
}
170
172
171
173
/**
172
- * { @inheritdoc}
174
+ * @inheritdoc
173
175
*/
174
176
public function save (\Magento \Framework \Model \AbstractModel $ object )
175
177
{
0 commit comments