Currently, we have a hard dependency of module InventoryCatalog on Inventory because of
class \Magento\InventoryCatalog\Model\SourceItem\SourceItemsSave
We use this class implementation to prevent repetitive synchronization of Legacy-MSI-Legacy update. To make this happen we add new implementation (along with one we have in Inventory Module) and disable Plugin on it
<type name="Magento\InventoryCatalog\Model\SourceItem\SourceItemsSave">
<plugin name="set_data_to_legacy_catalog_inventory_at_source_items_save" disabled="true"/>
</type>
what we need to do is:
- move class
\Magento\InventoryCatalog\Model\SourceItem\SourceItemsSave under the same namespace where \Magento\Inventory\Model\SourceItem\Command\SourceItemsSave stored
- rename SourceItemsSave -> SourceItemsSaveWithoutLegacySynchronization
- to prevent copy-pasting and making both class to have the same logic - introduce proxy
- inject this proxy in both of these classes
SourceItemsSaveWithoutLegacySynchronization and SourceItemsSave and proxy method execute on the newly created class
after that change dependency of InventoryCatalog to Inventory as "soft" one
Currently, we have a hard dependency of module InventoryCatalog on Inventory because of
class
\Magento\InventoryCatalog\Model\SourceItem\SourceItemsSaveWe use this class implementation to prevent repetitive synchronization of Legacy-MSI-Legacy update. To make this happen we add new implementation (along with one we have in Inventory Module) and disable Plugin on it
what we need to do is:
\Magento\InventoryCatalog\Model\SourceItem\SourceItemsSaveunder the same namespace where\Magento\Inventory\Model\SourceItem\Command\SourceItemsSavestoredSourceItemsSaveWithoutLegacySynchronizationandSourceItemsSaveand proxy method execute on the newly created classafter that change dependency of InventoryCatalog to Inventory as "soft" one