Reputation: 804
I am sending post data on this controller and for the sake of testing i added die in execution method as you can see below in my code.
But I am getting strange error even I am not using any parameter in constructor
the error
1 exception(s):
Exception #0 (Exception): Recoverable Error: Argument 1 passed to
Magento\Framework\App\Action\Action::__construct() must be an instance of Magento\Framework\App\Action\Context, none given, called in C:\wamp64\www\PG\app\code\Webkul\Marketplace\Controller\Account\Saveareainfo.php on line 30 and defined in C:\wamp64\www\PG\vendor\magento\framework\App\Action\Action.php on line 67
Exception #0 (Exception): Recoverable Error: Argument 1 passed to Magento\Framework\App\Action\Action::__construct() must be an instance of Magento\Framework\App\Action\Context, none given, called in C:\wamp64\www\PG\app\code\Webkul\Marketplace\Controller\Account\Saveareainfo.php on line 30 and defined in C:\wamp64\www\PG\vendor\magento\framework\App\Action\Action.php on line 67
#0 C:\wamp64\www\PG\vendor\magento\framework\App\Action\Action.php(67): Magento\Framework\App\ErrorHandler->handler(4096, 'Argument 1 pass...', 'C:\\wamp64\\www\\P...', 67, Array)
#1 C:\wamp64\www\PG\app\code\Webkul\Marketplace\Controller\Account\Saveareainfo.php(30): Magento\Framework\App\Action\Action->__construct()
#2 C:\wamp64\www\PG\var\generation\Webkul\Marketplace\Controller\Account\Saveareainfo\Interceptor.php(14): Webkul\Marketplace\Controller\Account\Saveareainfo->__construct(Object(Magento\Framework\App\Action\Context))
#3 C:\wamp64\www\PG\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php(93): Webkul\Marketplace\Controller\Account\Saveareainfo\Interceptor->__construct(Object(Magento\Framework\App\Action\Context))
#4 C:\wamp64\www\PG\vendor\magento\framework\ObjectManager\Factory\Compiled.php(88): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Webkul\\Marketpl...', Array)
#5 C:\wamp64\www\PG\vendor\magento\framework\ObjectManager\ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Compiled->create('Webkul\\Marketpl...', Array)
#6 C:\wamp64\www\PG\vendor\magento\framework\App\ActionFactory.php(40): Magento\Framework\ObjectManager\ObjectManager->create('Webkul\\Marketpl...')
#7 C:\wamp64\www\PG\vendor\magento\framework\App\Router\Base.php(300): Magento\Framework\App\ActionFactory->create('Webkul\\Marketpl...')
#8 C:\wamp64\www\PG\vendor\magento\framework\App\Router\Base.php(161): Magento\Framework\App\Router\Base->matchAction(Object(Magento\Framework\App\Request\Http), Array)
#9 C:\wamp64\www\PG\vendor\magento\framework\App\FrontController.php(50): Magento\Framework\App\Router\Base->match(Object(Magento\Framework\App\Request\Http))
#10 C:\wamp64\www\PG\vendor\magento\framework\Interception\Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#11 C:\wamp64\www\PG\vendor\magento\framework\Interception\Chain\Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#12 C:\wamp64\www\PG\vendor\magento\framework\Interception\Chain\Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'requestPreproce...')
#13 C:\wamp64\www\PG\vendor\magento\module-store\App\FrontController\Plugin\RequestPreprocessor.php(94): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#14 C:\wamp64\www\PG\vendor\magento\framework\Interception\Chain\Chain.php(67): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#15 C:\wamp64\www\PG\vendor\magento\framework\Interception\Chain\Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#16 C:\wamp64\www\PG\vendor\magento\framework\Module\Plugin\DbStatusValidator.php(69): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#17 C:\wamp64\www\PG\vendor\magento\framework\Interception\Chain\Chain.php(67): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#18 C:\wamp64\www\PG\vendor\magento\framework\Interception\Chain\Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#19 C:\wamp64\www\PG\vendor\magento\module-page-cache\Model\App\FrontController\BuiltinPlugin.php(68): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#20 C:\wamp64\www\PG\vendor\magento\framework\Interception\Chain\Chain.php(67): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#21 C:\wamp64\www\PG\vendor\magento\framework\Interception\Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#22 C:\wamp64\www\PG\vendor\magento\module-page-cache\Model\App\FrontController\VarnishPlugin.php(55): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#23 C:\wamp64\www\PG\vendor\magento\framework\Interception\Interceptor.php(142): Magento\PageCache\Model\App\FrontController\VarnishPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#24 C:\wamp64\www\PG\var\generation\Magento\Framework\App\FrontController\Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#25 C:\wamp64\www\PG\vendor\magento\framework\App\Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#26 C:\wamp64\www\PG\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\Http->launch()
#27 C:\wamp64\www\PG\index.php(40): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#28 {main}
My code
<?php
/**
* Webkul Software.
*
* @category Webkul
* @package Webkul_Marketplace
* @author Webkul
* @copyright Copyright (c) 2010-2016 Webkul Software Private Limited (https://webkul.com)
* @license https://store.webkul.com/license.html
*/
namespace Webkul\Marketplace\Controller\Account;
use Magento\Framework\App\Action\Action;
use Magento\Customer\Model\Session;
use Magento\Framework\App\Action\Context;
use Magento\Framework\Data\Form\FormKey\Validator as FormKeyValidator;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Filesystem;
use Magento\Framework\App\RequestInterface;
/**
* Webkul Marketplace Account SaveAreaInfo Controller.
*/
class Saveareainfo extends Action
{
public function __construct()
{
parent::__construct();
}
public function execute()
{
die( " Hello Test .. " );
}
}
Upvotes: 1
Views: 5114
Reputation: 3957
__construct()
method must be an instance of Magento\Framework\App\Action\Context
which was none given. It should be like
/**
* @param Context $context
*/
public function __construct(
Context $context
) {
parent::__construct($context);
}
Note: After deploying the module on remove the var/di and var/generation folders and recompile.
Upvotes: 3