diff --git a/app/code/Magento/InventoryCatalog/Plugin/Model/LegacyCatalogInventoryPlugin.php b/app/code/Magento/InventoryCatalog/Plugin/Model/LegacyCatalogInventoryPlugin.php new file mode 100644 index 0000000000000..d6cdc646642a9 --- /dev/null +++ b/app/code/Magento/InventoryCatalog/Plugin/Model/LegacyCatalogInventoryPlugin.php @@ -0,0 +1,74 @@ +resourceConnection = $resourceConnection; + } + + /** + * Plugin method to fill the legacy tables. + * + * @param ReservationsAppendInterface $subject + * @param callable $callable + * @param ReservationInterface[] $reservations + * @return mixed + * @see ReservationsAppendInterface::execute + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundExecute(ReservationsAppendInterface $subject, callable $callable, array $reservations) + { + $result = $callable($reservations); + $this->updateStockItemTable($reservations); + $this->updateStockStatusTable($reservations); + return $result; + } + + /** + * Update cataloginventory_stock_item qty with reservation information. + * + * @param ReservationInterface[] $reservations + * @return void + */ + private function updateStockItemTable(array $reservations) + { + // @todo impelemention reqiured + } + + /** + * Update cataloginventory_stock_status qty with reservation information. + * + * @param ReservationInterface[] $reservations + * @return void + */ + private function updateStockStatusTable(array $reservations) + { + // @todo impelemention reqiured + } +} diff --git a/app/code/Magento/InventoryCatalog/etc/di.xml b/app/code/Magento/InventoryCatalog/etc/di.xml index 997bbe26b3c4a..9175dc65ec298 100644 --- a/app/code/Magento/InventoryCatalog/etc/di.xml +++ b/app/code/Magento/InventoryCatalog/etc/di.xml @@ -11,4 +11,7 @@ + + +