Is your question related to a problem? Please describe.
I've updated one of our projects to Magento 2.3.2 (without the additional MSI project) + Elasticsuite 2.8.2. When running setup:di:compile the following error is triggered:
[ReflectionException]
Class Magento\InventorySalesApi\Api\StockResolverInterface does not exist
This comes from \Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Datasource\InventoryData. The StockResolverInterface is an additional interface provided by MSI. Does this mean that Elasticsuite requires MSI? Or is this a bug?
Additional context
We've updated from Magento 2.2.8 to Magento 2.3.2
Normally, we maintain support for legacy Inventory management via this class :
Which is called from here if MSI is not present : https://github.com/Smile-SA/elasticsuite/blob/2.8.x/src/module-elasticsuite-catalog/Model/Product/Indexer/Fulltext/Datasource/InventoryData.php#L88
But, I'm not talking about compilation here. Only about runtime, and process involved during catalogsearch reindex.
So there might be an issue during compilation if MSI modules are completely missing.
What is the state of your Magento instance ? Are the modules "here but disabled" (which is the default case when upgrading from Magento 2.2 to Magento 2.3), or are they completely missing ?
Thanks for getting back to me so quick @romainruaud!
I've completely removed MSI via composer replace, so that's why the class isn't there. I've now reinstalled MSI and disabled it, so compilng works again.
Would it be an idea to add the dependency magento/module-inventory-api or magento/module-inventory to the composer.json? Then users would get a composer error when they try to install Elasticsuite without MSI installed.
We got this kind of dependency : https://github.com/Smile-SA/elasticsuite/blob/2.8.x/composer.json#L42
But only for inventory-sales-api, inventory-sales and inventory-indexer, that should have, however, prevented you to install ElasticSuite without these modules. But maybe it does not complain because of your composer replace ? Kinda strange.
Tbh we should have probably gone to a solution where we publish a separate smile/elasticsuite-inventory module to handle the compatibility with MSI, but it would not have been as friendly as "just installing ElasticSuite".
I'm not feeling comfortable with any approach actually ...
I invoke @maghamed if he has any insights about this one :)
@Tjitse-E anything else needed on this issue ? If not, I'm gonna close it.
Regards
@romainruaud my question is answered, thanks. I'll close the issue.
Hi @romainruaud, @Tjitse-E I'm running into the same issue on 2.3.4. I've decided to remove all MSI and GraphQL modules from my installation after which DI compile fails on Elasticsuite. With the following patch you'll can it back to work again:
--- src/module-elasticsuite-catalog/etc/di.xml (date 1583919536000)
+++ src/module-elasticsuite-catalog/etc/di.xml (date 1583919536000)
@@ -276,7 +276,7 @@
</type>
<preference for="Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Datasource\InventoryDataInterface"
- type="Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Datasource\InventoryData" />
+ type="Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Indexer\Fulltext\Datasource\Deprication\InventoryData" />
<virtualType name="Smile\ElasticsuiteCatalog\Search\Request\Product\Coverage\Builder"
type="\Smile\ElasticsuiteCore\Search\Request\Builder">
--- src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/InventoryData.php (date 1583920544000)
+++ src/module-elasticsuite-catalog/Model/ResourceModel/Product/Indexer/Fulltext/Datasource/InventoryData.php (date 1583920544000)
@@ -57,16 +57,7 @@
* @param StockIndexTableNameResolverInterface $stockIndexTableProvider Stock index table provider.
*/
public function __construct(
- ResourceConnection $resource,
- StoreManagerInterface $storeManager,
- MetadataPool $metadataPool,
- StockResolverInterface $stockResolver,
- StockIndexTableNameResolverInterface $stockIndexTableProvider
) {
- $this->stockResolver = $stockResolver;
- $this->stockIndexTableProvider = $stockIndexTableProvider;
-
- parent::__construct($resource, $storeManager, $metadataPool);
}
/**
Most helpful comment
Hi @romainruaud, @Tjitse-E I'm running into the same issue on 2.3.4. I've decided to remove all MSI and GraphQL modules from my installation after which DI compile fails on Elasticsuite. With the following patch you'll can it back to work again: