can anyone tell me what am I doing wrong with this code
<?php namespace Feedback\Addon\Controller\Index; use Magento\Framework\App\Action\Context; use Feedback\Addon\Model\InsertFactory; class Save extends \Magento\Framework\App\Action\Action { /** * @var Test */ protected $_test; protected $_storeManager; public function __construct( Context $context, array $data = [], \Magento\Store\Model\StoreManagerInterface $storeManager, InsertFactory $test ) { $this->_storeManager = $storeManager; $this->_test = $test; parent::__construct($context); } public function execute() { $post = $this->getRequest()->getPostValue(); $test = $this->_test->create(); $data=array( 'first_name'=> $post['first_name'], 'last_name'=> $post['last_name'], 'email' => $post['email'], 'mobile_no' => $post['mobile_no'], 'feedback_content' => $post['feedback_content'] ); $test->setData($data); if($test->save()) { $this->messageManager->addSuccessMessage(__('You saved the data.')); $templateOptions = array('area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => $this->storeManager->getStore()->getId()); $templateVars = array( 'store' => $this->storeManager->getStore(), 'customer_name' => 'John Doe', 'message' => 'Hello!!.' ); $from = array('email' => "[email protected]", 'name' => 'Name of Sender'); $this->inlineTranslation->suspend(); $to = array('[email protected]'); $storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE; $templateId = $this->scopeConfig->getValue ( 'feedback/custom/email_template', \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $storeId ); $transport = $this->_transportBuilder->setTemplateIdentifier($templateId, $storeScope)->setTemplateOptions($templateOptions) ->setTemplateVars($templateVars) ->setFrom($from) ->addTo($to) ->getTransport(); $transport->sendMessage(); $this->messageManager->addSuccess(__('Mail Sent Successfully')); $this->inlineTranslation->resume(); } else { $this->messageManager->addErrorMessage(__('Data was not saved.')); } $resultRedirect = $this->resultRedirectFactory->create(); $resultRedirect->setPath('*/*/'); return $resultRedirect; } } I am trying to sending mail to the user after saving data but this is generated this error
Fatal error: Uncaught TypeError: Argument 3 passed to Feedback\Addon\Controller\Index\Save\Interceptor::__construct() must be of the type array, null given, called in /var/www/html/nuluv/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 111 and defined in /var/www/html/nuluv/generated/code/Feedback/Addon/Controller/Index/Save/Interceptor.php:11 Stack trace: #0 /var/www/html/nuluv/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(111): Feedback\Addon\Controller\Index\Save\Interceptor->__construct(Object(Magento\Framework\App\Action\Context), Object(Magento\Store\Model\StoreManager), NULL, Object(Feedback\Addon\Model\InsertFactory)) #1 /var/www/html/nuluv/vendor/magento/framework/ObjectManager/Factory/Compiled.php(108): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Feedback\Addon\...', Array) #2 /var/www/html/nuluv/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Compiled->create('Feedback\Addon\...', in /var/www/html/nuluv/generated/code/Feedback/Addon/Controller/Index/Save/Interceptor.php on line 11