5
5
*/
6
6
namespace Magento \Sales \Model ;
7
7
8
- use DomainException ;
9
8
use Magento \Framework \App \ResourceConnection ;
10
- use Magento \Sales \Api \Data \ShipmentCommentCreationInterface ;
11
- use Magento \Sales \Api \Data \ShipmentCreationArgumentsInterface ;
12
- use Magento \Sales \Api \Data \ShipmentItemCreationInterface ;
13
- use Magento \Sales \Api \Data \ShipmentPackageCreationInterface ;
14
- use Magento \Sales \Api \Data \ShipmentTrackCreationInterface ;
15
- use Magento \Sales \Api \Exception \CouldNotShipExceptionInterface ;
16
- use Magento \Sales \Api \Exception \DocumentValidationExceptionInterface ;
17
9
use Magento \Sales \Api \OrderRepositoryInterface ;
18
10
use Magento \Sales \Api \ShipmentRepositoryInterface ;
19
11
use Magento \Sales \Api \ShipOrderInterface ;
20
- use Magento \Sales \Exception \CouldNotShipException ;
21
- use Magento \Sales \Exception \DocumentValidationException ;
22
12
use Magento \Sales \Model \Order \Config as OrderConfig ;
23
13
use Magento \Sales \Model \Order \OrderStateResolverInterface ;
14
+ use Magento \Sales \Model \Order \ShipmentDocumentFactory ;
24
15
use Magento \Sales \Model \Order \Shipment \NotifierInterface ;
25
16
use Magento \Sales \Model \Order \Shipment \OrderRegistrarInterface ;
26
- use Magento \Sales \Model \Order \ShipmentDocumentFactory ;
27
17
use Magento \Sales \Model \Order \Validation \ShipOrderInterface as ShipOrderValidator ;
28
18
use Psr \Log \LoggerInterface ;
29
19
@@ -126,27 +116,29 @@ public function __construct(
126
116
* Process the shipment and save shipment and order data
127
117
*
128
118
* @param int $orderId
129
- * @param ShipmentItemCreationInterface[] $items
119
+ * @param \Magento\Sales\Api\Data\ ShipmentItemCreationInterface[] $items
130
120
* @param bool $notify
131
121
* @param bool $appendComment
132
- * @param ShipmentCommentCreationInterface|null $comment
133
- * @param ShipmentTrackCreationInterface[] $tracks
134
- * @param ShipmentPackageCreationInterface[] $packages
135
- * @param ShipmentCreationArgumentsInterface|null $arguments
122
+ * @param \Magento\Sales\Api\Data\ ShipmentCommentCreationInterface|null $comment
123
+ * @param \Magento\Sales\Api\Data\ ShipmentTrackCreationInterface[] $tracks
124
+ * @param \Magento\Sales\Api\Data\ ShipmentPackageCreationInterface[] $packages
125
+ * @param \Magento\Sales\Api\Data\ ShipmentCreationArgumentsInterface|null $arguments
136
126
* @return int
137
- * @throws DocumentValidationExceptionInterface
138
- * @throws CouldNotShipExceptionInterface
139
- * @throws DomainException
127
+ * @throws \Magento\Sales\Api\Exception\DocumentValidationExceptionInterface
128
+ * @throws \Magento\Sales\Api\Exception\CouldNotShipExceptionInterface
129
+ * @throws \Magento\Framework\Exception\InputException
130
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
131
+ * @throws \DomainException
140
132
*/
141
133
public function execute (
142
134
$ orderId ,
143
135
array $ items = [],
144
136
$ notify = false ,
145
137
$ appendComment = false ,
146
- ShipmentCommentCreationInterface $ comment = null ,
138
+ \ Magento \ Sales \ Api \ Data \ ShipmentCommentCreationInterface $ comment = null ,
147
139
array $ tracks = [],
148
140
array $ packages = [],
149
- ShipmentCreationArgumentsInterface $ arguments = null
141
+ \ Magento \ Sales \ Api \ Data \ ShipmentCreationArgumentsInterface $ arguments = null
150
142
) {
151
143
$ connection = $ this ->resourceConnection ->getConnection ('sales ' );
152
144
$ order = $ this ->orderRepository ->get ($ orderId );
@@ -170,7 +162,7 @@ public function execute(
170
162
$ packages
171
163
);
172
164
if ($ validationMessages ->hasMessages ()) {
173
- throw new DocumentValidationException (
165
+ throw new \ Magento \ Sales \ Exception \ DocumentValidationException (
174
166
__ ("Shipment Document Validation Error(s): \n" . implode ("\n" , $ validationMessages ->getMessages ()))
175
167
);
176
168
}
@@ -189,7 +181,7 @@ public function execute(
189
181
} catch (\Exception $ e ) {
190
182
$ this ->logger ->critical ($ e );
191
183
$ connection ->rollBack ();
192
- throw new CouldNotShipException (
184
+ throw new \ Magento \ Sales \ Exception \ CouldNotShipException (
193
185
__ ('Could not save a shipment, see error log for details ' )
194
186
);
195
187
}
0 commit comments