@@ -53,12 +53,12 @@ protected function _construct()
5353
5454 /**
5555 * @param \Magento\Framework\Model\ResourceModel\Db\Context $context
56- * @param Attribute $attribute
57- * @param Manager $sequenceManager
5856 * @param Snapshot $entitySnapshot
5957 * @param RelationComposite $entityRelationComposite
58+ * @param Attribute $attribute
59+ * @param Manager $sequenceManager
6060 * @param StateHandler $stateHandler
61- * @param string $connectionName
61+ * @param string|null $connectionName
6262 */
6363 public function __construct (
6464 \Magento \Framework \Model \ResourceModel \Db \Context $ context ,
@@ -137,6 +137,8 @@ protected function calculateItems(\Magento\Sales\Model\Order $object)
137137 }
138138
139139 /**
140+ * Before save
141+ *
140142 * @param \Magento\Framework\Model\AbstractModel $object
141143 * @return $this
142144 */
@@ -152,15 +154,15 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
152154 ];
153155 $ object ->setStoreName (implode (PHP_EOL , $ name ));
154156 $ 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+ );
155165 }
156- $ object ->setData (
157- 'protect_code ' ,
158- substr (
159- hash ('sha256 ' , uniqid (Random::getRandomNumber (), true ) . ': ' . microtime (true )),
160- 5 ,
161- 32
162- )
163- );
164166 $ isNewCustomer = !$ object ->getCustomerId () || $ object ->getCustomerId () === true ;
165167 if ($ isNewCustomer && $ object ->getCustomer ()) {
166168 $ object ->setCustomerId ($ object ->getCustomer ()->getId ());
@@ -169,7 +171,7 @@ protected function _beforeSave(\Magento\Framework\Model\AbstractModel $object)
169171 }
170172
171173 /**
172- * { @inheritdoc}
174+ * @inheritdoc
173175 */
174176 public function save (\Magento \Framework \Model \AbstractModel $ object )
175177 {
0 commit comments