stockIndexTableProvider = $stockIndexTableProvider; } /** * @param Collection $collection * @param int $stockId * @return void */ public function execute($collection, int $stockId) { $tableName = $this->stockIndexTableProvider->execute($stockId); $collection->getSelect()->join( ['inventory_in_stock' => $tableName], 'e.sku = inventory_in_stock.sku', [] )->where('inventory_in_stock.' . IndexStructure::IS_SALABLE . ' = ?', 1); } }