Hi guys ,
can anyone help on above mentioned error. i.e extra param passed inside parent constructor. Below is my code.
<?php
namespace Justin\Sellwithus\Controller\Index;
use Justin\Sellwithus\Model\ConfigInterface;
use Justin\Sellwithus\Model\MailInterface;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Request\DataPersistorInterface;
use Magento\Framework\Controller\Result\Redirect;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\HTTP\PhpEnvironment\Request;
use Psr\Log\LoggerInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\DataObject;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\MediaStorage\Model\File\UploaderFactory;
use Magento\Framework\Image\AdapterFactory;
use Magento\Framework\Filesystem;
class Post extends \Justin\Sellwithus\Controller\Index
{
private $dataPersistor;
private $context;
private $mail;
private $logger;
protected $uploaderFactory;
protected $adapterFactory;
protected $filesystem;
protected $_transportBuilder;
protected $inlineTranslation;
protected $scopeConfig;
protected $storeManager;
public function __construct(
Context $context,
ConfigInterface $contactsConfig,
MailInterface $mail,
DataPersistorInterface $dataPersistor,
LoggerInterface $logger = null,
\Magento\Framework\Mail\Template\TransportBuilder $transportBuilder,
\Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
UploaderFactory $uploaderFactory,
AdapterFactory $adapterFactory,
Filesystem $filesystem
) {
parent::__construct($context, $contactsConfig, $mail, $dataPersistor, $logger);
$this->context = $context;
$this->mail = $mail;
$this->dataPersistor = $dataPersistor;
$this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
$this->inlineTranslation = $inlineTranslation;
$this->_transportBuilder = $transportBuilder;
$this->scopeConfig = $scopeConfig;
$this->uploaderFactory = $uploaderFactory;
$this->adapterFactory = $adapterFactory;
$this->filesystem = $filesystem;
}
public function execute()
{
echo "hi";exit;
}
Solved! Go to Solution.
Hi @bharath553
Can you send me construct of \Justin\Sellwithus\Controller\Index file?
As you have extended this file so all the parameters passed in extended file must be returned from here,
parent::__construct($context, $contactsConfig, $mail, $dataPersistor, $logger);
So I think the problem is that you might have returned any extra param which is not required or the sequence of sending parameter is not right.
If you will send me construct of extended file I can check the issue?
What kind of error you are getting?
Please post error code and mention clear about your problem.
Hi @bharath553
Can you send me construct of \Justin\Sellwithus\Controller\Index file?
As you have extended this file so all the parameters passed in extended file must be returned from here,
parent::__construct($context, $contactsConfig, $mail, $dataPersistor, $logger);
So I think the problem is that you might have returned any extra param which is not required or the sequence of sending parameter is not right.
If you will send me construct of extended file I can check the issue?
Simply don't pass extra params to parent constructor. You want to keep the params passed to parent are exactly as parent defined, and you don't need to pass all params to parent.