|
5 | 5 | */
|
6 | 6 | namespace Magento\Sales\Model;
|
7 | 7 |
|
| 8 | +use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface; |
8 | 9 | use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
|
| 10 | +use Magento\Framework\App\ObjectManager; |
9 | 11 | use Magento\Framework\Exception\InputException;
|
10 | 12 | use Magento\Framework\Exception\NoSuchEntityException;
|
11 | 13 | use Magento\Sales\Api\Data\OrderExtensionFactory;
|
|
15 | 17 | use Magento\Sales\Api\Data\ShippingAssignmentInterface;
|
16 | 18 | use Magento\Sales\Model\Order\ShippingAssignmentBuilder;
|
17 | 19 | use Magento\Sales\Model\ResourceModel\Metadata;
|
18 |
| -use Magento\Framework\App\ObjectManager; |
19 | 20 |
|
20 | 21 | /**
|
21 | 22 | * Repository class
|
@@ -54,26 +55,35 @@ class OrderRepository implements \Magento\Sales\Api\OrderRepositoryInterface
|
54 | 55 | */
|
55 | 56 | protected $registry = [];
|
56 | 57 |
|
| 58 | + /** |
| 59 | + * @var JoinProcessorInterface |
| 60 | + */ |
| 61 | + private $extensionAttributesJoinProcessor; |
| 62 | + |
57 | 63 | /**
|
58 | 64 | * Constructor
|
59 | 65 | *
|
60 | 66 | * @param Metadata $metadata
|
61 | 67 | * @param SearchResultFactory $searchResultFactory
|
62 | 68 | * @param CollectionProcessorInterface|null $collectionProcessor
|
63 | 69 | * @param \Magento\Sales\Api\Data\OrderExtensionFactory|null $orderExtensionFactory
|
| 70 | + * @param JoinProcessorInterface $extensionAttributesJoinProcessor |
64 | 71 | */
|
65 | 72 | public function __construct(
|
66 | 73 | Metadata $metadata,
|
67 | 74 | SearchResultFactory $searchResultFactory,
|
68 | 75 | CollectionProcessorInterface $collectionProcessor = null,
|
69 |
| - \Magento\Sales\Api\Data\OrderExtensionFactory $orderExtensionFactory = null |
| 76 | + \Magento\Sales\Api\Data\OrderExtensionFactory $orderExtensionFactory = null, |
| 77 | + JoinProcessorInterface $extensionAttributesJoinProcessor = null |
70 | 78 | ) {
|
71 | 79 | $this->metadata = $metadata;
|
72 | 80 | $this->searchResultFactory = $searchResultFactory;
|
73 | 81 | $this->collectionProcessor = $collectionProcessor ?: ObjectManager::getInstance()
|
74 | 82 | ->get(\Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface::class);
|
75 | 83 | $this->orderExtensionFactory = $orderExtensionFactory ?: ObjectManager::getInstance()
|
76 | 84 | ->get(\Magento\Sales\Api\Data\OrderExtensionFactory::class);
|
| 85 | + $this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor |
| 86 | + ?: ObjectManager::getInstance()->get(JoinProcessorInterface::class); |
77 | 87 | }
|
78 | 88 |
|
79 | 89 | /**
|
@@ -112,6 +122,7 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
|
112 | 122 | /** @var \Magento\Sales\Api\Data\OrderSearchResultInterface $searchResult */
|
113 | 123 | $searchResult = $this->searchResultFactory->create();
|
114 | 124 | $this->collectionProcessor->process($searchCriteria, $searchResult);
|
| 125 | + $this->extensionAttributesJoinProcessor->process($searchResult); |
115 | 126 | $searchResult->setSearchCriteria($searchCriteria);
|
116 | 127 | foreach ($searchResult->getItems() as $order) {
|
117 | 128 | $this->setShippingAssignments($order);
|
|
0 commit comments