private function getResourceModel() : InventoryDataInterface
    {
        if ($this->resourceModel === null) {
            $resourceName = InventoryDataInterface::class;

            try {
                // Will try to fetch default implementation and fail in case of missing MSI modules or dependencies.
                $stockResolver = $this->config->getPreference(\Magento\InventorySalesApi\Api\StockResolverInterface::class);
                if (ltrim($stockResolver, '\\') === ltrim(\Magento\InventorySalesApi\Api\StockResolverInterface::class, '\\')) {
                    $resourceName = Deprecation::class;
                }
            } catch (\Exception $exception) {
                ; // Nothing to do, it's already kinda hacky to allow this deprecation fallback to happen.
            }

            $this->resourceModel = $this->objectManager->get($resourceName);
        }

        return $this->resourceModel;
    }
private function getResourceModel() : InventoryDataInterface
    {
        if ($this->resourceModel === null) {
            $resourceName = InventoryDataInterface::class;

            try {
                // Will try to fetch default implementation and fail in case of missing MSI modules or dependencies.
                $stockResolver = $this->config->getPreference(\Magento\InventorySalesApi\Api\StockResolverInterface::class);
                if (ltrim($stockResolver, '\\') === ltrim(\Magento\InventorySalesApi\Api\StockResolverInterface::class, '\\')) {
                    $resourceName = Deprecation::class;
                }
            } catch (\Exception $exception) {
                ; // Nothing to do, it's already kinda hacky to allow this deprecation fallback to happen.
            }

            $this->resourceModel = $this->objectManager->get($resourceName);
        }

        return $this->resourceModel;
    }
private function getResourceModel ( ) : InventoryDataInterface { if ( $ this -> resourceModel === null ) { $ resourceName = InventoryDataInterface :: class ; try { // Will try to fetch default implementation and fail in case of missing MSI modules or dependencies. $ stockResolver = $ this -> config -> getPreference ( \ Magento \ InventorySalesApi \ Api \ StockResolverInterface :: class ) ; if ( ltrim ( $ stockResolver , '\\' ) === ltrim ( \ Magento \ InventorySalesApi \ Api \ StockResolverInterface :: class , '\\' ) ) { $ resourceName = Deprecation :: class ; } } catch ( \ Exception $ exception ) { ; // Nothing to do, it's already kinda hacky to allow this deprecation fallback to happen. } $ this -> resourceModel = $ this -> objectManager -> get ( $ resourceName ) ; } return $ this -> resourceModel ; }
Init proper resource model.

Should be default implementation of InventoryDataInterface if MSI modules are enabled.

Otherwise we fallback to old-style CatalogInventory indexing.

@deprecated To be removed with Magento 2.4 and the dismantlement of legacy CatalogInventory module.

@return InventoryDataInterface
Init proper resource model .