6
6
7
7
namespace Magento \Sales \Model ;
8
8
9
+ use Magento \Framework \Api \ExtensionAttribute \JoinProcessorInterface ;
9
10
use Magento \Framework \Api \SearchCriteria \CollectionProcessorInterface ;
11
+ use Magento \Framework \App \ObjectManager ;
10
12
use Magento \Framework \Exception \InputException ;
11
13
use Magento \Framework \Exception \NoSuchEntityException ;
12
14
use Magento \Sales \Api \Data \OrderExtensionFactory ;
16
18
use Magento \Sales \Api \Data \ShippingAssignmentInterface ;
17
19
use Magento \Sales \Model \Order \ShippingAssignmentBuilder ;
18
20
use Magento \Sales \Model \ResourceModel \Metadata ;
19
- use Magento \Framework \App \ObjectManager ;
20
21
use Magento \Tax \Api \OrderTaxManagementInterface ;
21
22
use Magento \Payment \Api \Data \PaymentAdditionalInfoInterface ;
22
23
use Magento \Payment \Api \Data \PaymentAdditionalInfoInterfaceFactory ;
@@ -74,6 +75,11 @@ class OrderRepository implements \Magento\Sales\Api\OrderRepositoryInterface
74
75
*/
75
76
private $ serializer ;
76
77
78
+ /**
79
+ * @var JoinProcessorInterface
80
+ */
81
+ private $ extensionAttributesJoinProcessor ;
82
+
77
83
/**
78
84
* Constructor
79
85
*
@@ -84,6 +90,7 @@ class OrderRepository implements \Magento\Sales\Api\OrderRepositoryInterface
84
90
* @param OrderTaxManagementInterface|null $orderTaxManagement
85
91
* @param PaymentAdditionalInfoInterfaceFactory|null $paymentAdditionalInfoFactory
86
92
* @param JsonSerializer|null $serializer
93
+ * @param JoinProcessorInterface $extensionAttributesJoinProcessor
87
94
*/
88
95
public function __construct (
89
96
Metadata $ metadata ,
@@ -92,7 +99,8 @@ public function __construct(
92
99
\Magento \Sales \Api \Data \OrderExtensionFactory $ orderExtensionFactory = null ,
93
100
OrderTaxManagementInterface $ orderTaxManagement = null ,
94
101
PaymentAdditionalInfoInterfaceFactory $ paymentAdditionalInfoFactory = null ,
95
- JsonSerializer $ serializer = null
102
+ JsonSerializer $ serializer = null ,
103
+ JoinProcessorInterface $ extensionAttributesJoinProcessor = null
96
104
) {
97
105
$ this ->metadata = $ metadata ;
98
106
$ this ->searchResultFactory = $ searchResultFactory ;
@@ -106,6 +114,8 @@ public function __construct(
106
114
->get (PaymentAdditionalInfoInterfaceFactory::class);
107
115
$ this ->serializer = $ serializer ?: ObjectManager::getInstance ()
108
116
->get (JsonSerializer::class);
117
+ $ this ->extensionAttributesJoinProcessor = $ extensionAttributesJoinProcessor
118
+ ?: ObjectManager::getInstance ()->get (JoinProcessorInterface::class);
109
119
}
110
120
111
121
/**
@@ -198,6 +208,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
198
208
{
199
209
/** @var \Magento\Sales\Api\Data\OrderSearchResultInterface $searchResult */
200
210
$ searchResult = $ this ->searchResultFactory ->create ();
211
+ $ this ->extensionAttributesJoinProcessor ->process ($ searchResult );
201
212
$ this ->collectionProcessor ->process ($ searchCriteria , $ searchResult );
202
213
$ searchResult ->setSearchCriteria ($ searchCriteria );
203
214
foreach ($ searchResult ->getItems () as $ order ) {
0 commit comments