Skip to content

Commit 50477f2

Browse files
author
Mike Weis
committed
MAGETWO-33664: Refactor Sales module to use mutable data object interfaces
- relax setter parameters when getters handle more than an array of objects
1 parent d3ac9da commit 50477f2

File tree

11 files changed

+178
-178
lines changed

11 files changed

+178
-178
lines changed

app/code/Magento/Sales/Api/Data/CreditmemoInterface.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -561,13 +561,29 @@ public function getUpdatedAt();
561561
*/
562562
public function getItems();
563563

564+
/**
565+
* Sets credit memo items.
566+
*
567+
* @param \Magento\Sales\Api\Data\CreditmemoItemInterface[] $items
568+
* @return $this
569+
*/
570+
public function setItems($items);
571+
564572
/**
565573
* Gets credit memo comments.
566574
*
567575
* @return \Magento\Sales\Api\Data\CreditmemoCommentInterface[]|null Array of any credit memo comments. Otherwise, null.
568576
*/
569577
public function getComments();
570578

579+
/**
580+
* Sets credit memo comments.
581+
*
582+
* @param \Magento\Sales\Api\Data\CreditmemoCommentInterface[] $comments
583+
* @return $this
584+
*/
585+
public function setComments($comments);
586+
571587
/**
572588
* Sets the credit memo store ID.
573589
*
@@ -911,20 +927,4 @@ public function setBaseShippingInclTax($amount);
911927
* @return $this
912928
*/
913929
public function setDiscountDescription($description);
914-
915-
/**
916-
* Sets credit memo items.
917-
*
918-
* @param \Magento\Sales\Api\Data\CreditmemoItemInterface[] $items
919-
* @return $this
920-
*/
921-
public function setItems(array $items = null);
922-
923-
/**
924-
* Sets credit memo comments.
925-
*
926-
* @param \Magento\Sales\Api\Data\CreditmemoCommentInterface[] $comments
927-
* @return $this
928-
*/
929-
public function setComments(array $comments = null);
930930
}

app/code/Magento/Sales/Api/Data/InvoiceInterface.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -515,13 +515,29 @@ public function getUpdatedAt();
515515
*/
516516
public function getItems();
517517

518+
/**
519+
* Sets the items in the invoice.
520+
*
521+
* @param \Magento\Sales\Api\Data\InvoiceItemInterface[] $items
522+
* @return $this
523+
*/
524+
public function setItems($items);
525+
518526
/**
519527
* Gets the comments, if any, for the invoice.
520528
*
521529
* @return \Magento\Sales\Api\Data\InvoiceCommentInterface[]|null Array of any invoice comments. Otherwise, null.
522530
*/
523531
public function getComments();
524532

533+
/**
534+
* Sets the comments, if any, for the invoice.
535+
*
536+
* @param \Magento\Sales\Api\Data\InvoiceCommentInterface[] $comments
537+
* @return $this
538+
*/
539+
public function setComments($comments);
540+
525541
/**
526542
* Sets the updated-at timestamp for the invoice.
527543
*
@@ -849,20 +865,4 @@ public function setBaseTotalRefunded($amount);
849865
* @return $this
850866
*/
851867
public function setDiscountDescription($description);
852-
853-
/**
854-
* Sets the items in the invoice.
855-
*
856-
* @param \Magento\Sales\Api\Data\InvoiceItemInterface[] $items
857-
* @return $this
858-
*/
859-
public function setItems($items);
860-
861-
/**
862-
* Sets the comments, if any, for the invoice.
863-
*
864-
* @param \Magento\Sales\Api\Data\InvoiceCommentInterface[] $comments
865-
* @return $this
866-
*/
867-
public function setComments(array $comments = null);
868868
}

app/code/Magento/Sales/Api/Data/OrderInterface.php

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,41 +1526,89 @@ public function getXForwardedFor();
15261526
*/
15271527
public function getItems();
15281528

1529+
/**
1530+
* Sets items for the order.
1531+
*
1532+
* @param \Magento\Sales\Api\Data\OrderItemInterface[] $items
1533+
* @return $this
1534+
*/
1535+
public function setItems($items);
1536+
15291537
/**
15301538
* Gets the billing address, if any, for the order.
15311539
*
15321540
* @return \Magento\Sales\Api\Data\OrderAddressInterface|null Billing address. Otherwise, null.
15331541
*/
15341542
public function getBillingAddress();
15351543

1544+
/**
1545+
* Sets the billing address, if any, for the order.
1546+
*
1547+
* @param \Magento\Sales\Api\Data\OrderAddressInterface $billingAddress
1548+
* @return $this
1549+
*/
1550+
public function setBillingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $billingAddress = null);
1551+
15361552
/**
15371553
* Gets the shipping address, if any, for the order.
15381554
*
15391555
* @return \Magento\Sales\Api\Data\OrderAddressInterface|null Shipping address. Otherwise, null.
15401556
*/
15411557
public function getShippingAddress();
15421558

1559+
/**
1560+
* Sets the shipping address, if any, for the order.
1561+
*
1562+
* @param \Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress
1563+
* @return $this
1564+
*/
1565+
public function setShippingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress = null);
1566+
15431567
/**
15441568
* Gets the payments for the order.
15451569
*
15461570
* @return \Magento\Sales\Api\Data\OrderPaymentInterface[] Array of payments.
15471571
*/
15481572
public function getPayments();
15491573

1574+
/**
1575+
* Sets the payments for the order.
1576+
*
1577+
* @param \Magento\Sales\Api\Data\OrderPaymentInterface[] $payments
1578+
* @return $this
1579+
*/
1580+
public function setPayments(array $payments = null);
1581+
15501582
/**
15511583
* Gets addresses for the order.
15521584
*
15531585
* @return \Magento\Sales\Api\Data\OrderAddressInterface[] Array of addresses.
15541586
*/
15551587
public function getAddresses();
15561588

1589+
/**
1590+
* Sets addresses for the order.
1591+
*
1592+
* @param \Magento\Sales\Api\Data\OrderAddressInterface[] $addresses
1593+
* @return $this
1594+
*/
1595+
public function setAddresses(array $addresses = null);
1596+
15571597
/**
15581598
* Gets status histories for the order.
15591599
*
15601600
* @return \Magento\Sales\Api\Data\OrderStatusHistoryInterface[] Array of status histories.
15611601
*/
15621602
public function getStatusHistories();
15631603

1604+
/**
1605+
* Sets status histories for the order.
1606+
*
1607+
* @param \Magento\Sales\Api\Data\OrderStatusHistoryInterface[] $statusHistories
1608+
* @return $this
1609+
*/
1610+
public function setStatusHistories(array $statusHistories = null);
1611+
15641612
/**
15651613
* Sets the state for the order.
15661614
*
@@ -2616,52 +2664,4 @@ public function setShippingInclTax($amount);
26162664
* @return $this
26172665
*/
26182666
public function setBaseShippingInclTax($amount);
2619-
2620-
/**
2621-
* Sets items for the order.
2622-
*
2623-
* @param \Magento\Sales\Api\Data\OrderItemInterface[] $items
2624-
* @return $this
2625-
*/
2626-
public function setItems(array $items = null);
2627-
2628-
/**
2629-
* Sets the billing address, if any, for the order.
2630-
*
2631-
* @param \Magento\Sales\Api\Data\OrderAddressInterface $billingAddress
2632-
* @return $this
2633-
*/
2634-
public function setBillingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $billingAddress = null);
2635-
2636-
/**
2637-
* Sets the shipping address, if any, for the order.
2638-
*
2639-
* @param \Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress
2640-
* @return $this
2641-
*/
2642-
public function setShippingAddress(\Magento\Sales\Api\Data\OrderAddressInterface $shippingAddress = null);
2643-
2644-
/**
2645-
* Sets the payments for the order.
2646-
*
2647-
* @param \Magento\Sales\Api\Data\OrderPaymentInterface[] $payments
2648-
* @return $this
2649-
*/
2650-
public function setPayments(array $payments = null);
2651-
2652-
/**
2653-
* Sets addresses for the order.
2654-
*
2655-
* @param \Magento\Sales\Api\Data\OrderAddressInterface[] $addresses
2656-
* @return $this
2657-
*/
2658-
public function setAddresses(array $addresses = null);
2659-
2660-
/**
2661-
* Sets status histories for the order.
2662-
*
2663-
* @param \Magento\Sales\Api\Data\OrderStatusHistoryInterface[] $statusHistories
2664-
* @return $this
2665-
*/
2666-
public function setStatusHistories(array $statusHistories = null);
26672667
}

app/code/Magento/Sales/Api/Data/OrderItemInterface.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,14 @@ public function getProductId();
851851
*/
852852
public function getProductOptions();
853853

854+
/**
855+
* Sets the product options for the order item.
856+
*
857+
* @param string[] $productOptions
858+
* @return $this
859+
*/
860+
public function setProductOptions($productOptions);
861+
854862
/**
855863
* Gets the product type for the order item.
856864
*
@@ -1054,6 +1062,14 @@ public function getWeight();
10541062
*/
10551063
public function getParentItem();
10561064

1065+
/**
1066+
* Sets the parent item
1067+
*
1068+
* @param \Magento\Sales\Api\Data\OrderItemInterface $parentItem
1069+
* @return $this
1070+
*/
1071+
public function setParentItem($parentItem);
1072+
10571073
/**
10581074
* Sets the updated-at timestamp for the order item.
10591075
*
@@ -1118,14 +1134,6 @@ public function setProductId($id);
11181134
*/
11191135
public function setProductType($productType);
11201136

1121-
/**
1122-
* Sets the product options for the order item.
1123-
*
1124-
* @param string[] $productOptions
1125-
* @return $this
1126-
*/
1127-
public function setProductOptions(array $productOptions = null);
1128-
11291137
/**
11301138
* Sets the weight for the order item.
11311139
*
@@ -1789,12 +1797,4 @@ public function setBaseWeeeTaxDisposition($baseWeeeTaxDisposition);
17891797
* @return $this
17901798
*/
17911799
public function setBaseWeeeTaxRowDisposition($baseWeeeTaxRowDisposition);
1792-
1793-
/**
1794-
* Sets the parent item
1795-
*
1796-
* @param \Magento\Sales\Api\Data\OrderItemInterface $parentItem
1797-
* @return $this
1798-
*/
1799-
public function setParentItem($parentItem);
18001800
}

app/code/Magento/Sales/Api/Data/ShipmentInterface.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ public function getOrderId();
145145
*/
146146
public function getPackages();
147147

148+
/**
149+
* Sets any packages for the shipment.
150+
*
151+
* @param \Magento\Sales\Api\Data\ShipmentPackageInterface[] $packages
152+
* @return $this
153+
*/
154+
public function setPackages(array $packages = null);
155+
148156
/**
149157
* Gets the shipment status.
150158
*
@@ -310,12 +318,4 @@ public function setShippingLabel($shippingLabel);
310318
* @return $this
311319
*/
312320
public function setUpdatedAt($timestamp);
313-
314-
/**
315-
* Sets any packages for the shipment.
316-
*
317-
* @param \Magento\Sales\Api\Data\ShipmentPackageInterface[] $packages
318-
* @return $this
319-
*/
320-
public function setPackages(array $packages = null);
321321
}

app/code/Magento/Sales/Api/Data/TransactionInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function setIsClosed($isClosed);
204204
/**
205205
* Additional information setter
206206
* Updates data inside the 'additional_information' array
207-
* Doesn't allow to set arrays
207+
* Does not allow setting of arrays
208208
*
209209
* @param string $key
210210
* @param mixed $value

0 commit comments

Comments
 (0)