We are using Magento 2 rest api to load the model data. WE have created model in Company/Module/Model/Module.php

namespace Company\Module\Model\Api;

      use Magento\Framework\Exception\NoSuchEntityException;
      use Magento\Framework\DataObject;
      use Company\Module\Api\ModuleInterface;
      use Company\Module\Model\Module;
      use Magento\Framework\App\Config\ScopeConfigInterface;
      use Magento\Framework\ObjectManagerInterface;
      class Banner extends \Magento\Framework\Model\AbstractModel

       protected $banner;
       protected $scopeconfiginterface;
       protected $objectManager;

        public function __construct(Module $Module,ScopeConfigInterface $scopeconfiginterface)

          $this->_Module = $Module;
          $this->_scopeconfiginterface = $scopeconfiginterface;


  public function getbannerlist(){
       return 'Hello';

Using this model we are getting collection data in block but when we use model in rest api method then it throws error.

In above code doing nothing wrong despite throwing error. If i comment the constructor then it works. what could be the issue?
enter image description here

Any help would be appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.