Type Error occurred when creating object in magento 2 controller

Viewed 6752
Exception #0 (Magento\Framework\Exception\RuntimeException): Type Error occurred when creating object: 

Itpl\Shippingavailability\Controller\Pincode\Check\Interceptor

namespace Itpl\Shippingavailability\Controller\Pincode;
use Itpl\Shippingavailability\Model\ResourceModel\Pincode\CollectionFactory;

class Check extends \Magento\Framework\App\Action\Action
{
   protected $_collectionFactory;
   protected $resultPageFactory;
   protected $jsonHelper;
   protected $_helper;

   /**
    * Constructor
    *
    * @param \Magento\Framework\App\Action\Context  $context
    * @param \Magento\Framework\Json\Helper\Data $jsonHelper
    */
   public function __construct(
       \Magento\Framework\App\Action\Context $context,
       \Magento\Framework\View\Result\PageFactory $resultPageFactory,
       \Magento\Framework\Json\Helper\Data $jsonHelper,
       CollectionFactory $collectionFactory

   ) {
       $this->resultPageFactory = $resultPageFactory;
       $this->jsonHelper = $jsonHelper;
       parent::__construct($context);
       $this->_collectionFactory = $collectionFactory;
   }

   /**
    * Execute view action
    *
    * @return \Magento\Framework\Controller\ResultInterface
    */

   public function execute()
   {
       $resultPage = $this->_collectionFactory->create();
       $collection = $resultPage->getCollection(); //Get Collection of module data
       var_dump($collection->getData());
       exit;
}

I am trying to get pin code collection from the model. Same code os working in the model file but it is getting an error in the controller file. Please check and give me some relevent solution.

0 Answers
Related