|
12 | 12 | use Emartech\Emarsys\Api\Data\InventoryItemInterfaceFactory; |
13 | 13 | use Emartech\Emarsys\Api\Data\InventoryItemItemInterfaceFactory; |
14 | 14 | use Emartech\Emarsys\Api\InventoryApiInterface; |
| 15 | +use Magento\Framework\App\ObjectManager; |
15 | 16 | use Magento\Framework\Model\ResourceModel\Iterator; |
16 | 17 | use Magento\Inventory\Model\ResourceModel\SourceItem\Collection as SourceItemCollection; |
17 | | -use Magento\Inventory\Model\ResourceModel\SourceItem\CollectionFactory as SourceItemCollectionFactory; |
18 | 18 |
|
19 | 19 | /** |
20 | 20 | * Class InventoryApi |
|
23 | 23 | */ |
24 | 24 | class InventoryApi implements InventoryApiInterface |
25 | 25 | { |
26 | | - /** |
27 | | - * @var SourceItemCollectionFactory |
28 | | - */ |
29 | | - private $sourceItemCollectionFactory; |
30 | 26 |
|
31 | 27 | /** |
32 | 28 | * @var SourceItemCollection |
@@ -61,20 +57,17 @@ class InventoryApi implements InventoryApiInterface |
61 | 57 | /** |
62 | 58 | * InventoryApi constructor. |
63 | 59 | * |
64 | | - * @param SourceItemCollectionFactory $sourceItemCollectionFactory |
65 | 60 | * @param InventoryApiResponseInterfaceFactory $inventoryApiResponseFactory |
66 | 61 | * @param InventoryItemInterfaceFactory $inventoryItemInterfaceFactory |
67 | 62 | * @param InventoryItemItemInterfaceFactory $inventoryItemItemFactory |
68 | 63 | * @param Iterator $iterator |
69 | 64 | */ |
70 | 65 | public function __construct( |
71 | | - SourceItemCollectionFactory $sourceItemCollectionFactory, |
72 | 66 | InventoryApiResponseInterfaceFactory $inventoryApiResponseFactory, |
73 | 67 | InventoryItemInterfaceFactory $inventoryItemInterfaceFactory, |
74 | 68 | InventoryItemItemInterfaceFactory $inventoryItemItemFactory, |
75 | 69 | Iterator $iterator |
76 | 70 | ) { |
77 | | - $this->sourceItemCollectionFactory = $sourceItemCollectionFactory; |
78 | 71 | $this->inventoryApiResponseFactory = $inventoryApiResponseFactory; |
79 | 72 | $this->inventoryItemFactory = $inventoryItemInterfaceFactory; |
80 | 73 | $this->inventoryItemItemFactory = $inventoryItemItemFactory; |
@@ -189,7 +182,7 @@ private function handleInventoryItems(array $stockData): array |
189 | 182 | */ |
190 | 183 | private function initCollection(): InventoryApiInterface |
191 | 184 | { |
192 | | - $this->sourceItemCollection = $this->sourceItemCollectionFactory->create(); |
| 185 | + $this->sourceItemCollection = ObjectManager::getInstance()->create(SourceItemCollection::class); |
193 | 186 |
|
194 | 187 | return $this; |
195 | 188 | } |
|
0 commit comments