cancel
Showing results for 
Search instead for 
Did you mean: 

Class Magento\InventoryCatalog\Model\SourceItemsProcessor does not exist

SOLVED

Class Magento\InventoryCatalog\Model\SourceItemsProcessor does not exist

i have magento 2.3.4 and i'm installed Inventory and all commands working easy but with last command 

php bin/magento setup:di:compile 

 

i get this error 

 

Class Magento\InventoryCatalog\Model\SourceItemsProcessor does not exist

 

any fix for this 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Class Magento\InventoryCatalog\Model\SourceItemsProcessor does not exist

this slove by me you will create file with name SourceItemsProcessor in path Magento\InventoryCatalog\Mode 

 

and put this code 

 

<?php

namespace Magento\InventoryCatalog\Model;

use Magento\InventoryApi\Api\Data\SourceItemInterface;

class SourceItemsProcessor
{
    protected $sourceItemRepository;

    public function __construct(
        \Magento\InventoryApi\Api\SourceItemRepositoryInterface $sourceItemRepository
    ) {
        $this->sourceItemRepository = $sourceItemRepository;
    }

    public function process(SourceItemInterface $sourceItem)
    {
        // Implement your source item processing logic here.
        // You can access and modify the source item properties using $sourceItem.

        // Example: Update the source item quantity.
        $sourceItem->setQuantity(100);

        // Save the updated source item.
        $this->sourceItemRepository->save($sourceItem);
    }
}

View solution in original post

1 REPLY 1

Re: Class Magento\InventoryCatalog\Model\SourceItemsProcessor does not exist

this slove by me you will create file with name SourceItemsProcessor in path Magento\InventoryCatalog\Mode 

 

and put this code 

 

<?php

namespace Magento\InventoryCatalog\Model;

use Magento\InventoryApi\Api\Data\SourceItemInterface;

class SourceItemsProcessor
{
    protected $sourceItemRepository;

    public function __construct(
        \Magento\InventoryApi\Api\SourceItemRepositoryInterface $sourceItemRepository
    ) {
        $this->sourceItemRepository = $sourceItemRepository;
    }

    public function process(SourceItemInterface $sourceItem)
    {
        // Implement your source item processing logic here.
        // You can access and modify the source item properties using $sourceItem.

        // Example: Update the source item quantity.
        $sourceItem->setQuantity(100);

        // Save the updated source item.
        $this->sourceItemRepository->save($sourceItem);
    }
}