My controller working but getFullActionName()
not called
My controller path: Magento20/app/code/Test/Module1/Controller/Index/Index
<?php
namespace Test\Module1\Controller\Index;
class Index extends \Magento\Framework\App\Action\Action {
protected $resultPageFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\App\Request\Http $request,
\Magento\Framework\View\Result\PageFactory $resultPageFactory)
{
parent::__construct($context);
echo $request->getFullActionName(); // THIS CODE IS NOT WORK
die();
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->prepend(__('test example'));
return $resultPage;
}
}
?>
Edit
error is
a:4:{i:0;s:446:"Recoverable Error: Argument 2 passed to Test\Module1\Controller\Index\Index::__construct() must be an instance of Magento\Framework\App\Request\Http, instance of Magento\Framework\View\Result\PageFactory given, called in C:\xampp\htdocs\magento20\var\generation\Test\Module1\Controller\Index\Index\Interceptor.php on line 14 and defined in C:\xampp\htdocs\magento20\app\code\Test\Module1\Controller\Index\Index.php on line 11";i:1;s:7015:"#0 C:\xampp\htdocs\magento20\app\code\Test\Module1\Controller\Index\Index.php(11): Magento\Framework\App\ErrorHandler->handler(4096, 'Argument 2 pass...', 'C:\\xampp\\htdocs...', 11, Array)
#1 C:\xampp\htdocs\magento20\var\generation\Test\Module1\Controller\Index\Index\Interceptor.php(14): Test\Module1\Controller\Index\Index->__construct(Object(Magento\Framework\App\Action\Context), Object(Magento\Framework\View\Result\PageFactory))
#2 C:\xampp\htdocs\magento20\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php(99): Test\Module1\Controller\Index\Index\Interceptor->__construct(Object(Magento\Framework\App\Action\Context), Object(Magento\Framework\View\Result\PageFactory))
#3 C:\xampp\htdocs\magento20\vendor\magento\framework\ObjectManager\Factory\Dynamic\Developer.php(89): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Test\\Marketp...', Array)
#4 C:\xampp\htdocs\magento20\vendor\magento\framework\ObjectManager\ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Test\\Marketp...', Array)
#5 C:\xampp\htdocs\magento20\vendor\magento\framework\App\ActionFactory.php(37): Magento\Framework\ObjectManager\ObjectManager->create('Test\\Marketp...')
#6 C:\xampp\htdocs\magento20\vendor\magento\framework\App\Router\Base.php(300): Magento\Framework\App\ActionFactory->create('Test\\Marketp...')
#7 C:\xampp\htdocs\magento20\vendor\magento\framework\App\Router\Base.php(161): Magento\Framework\App\Router\Base->matchAction(Object(Magento\Framework\App\Request\Http), Array)
#8 C:\xampp\htdocs\magento20\vendor\magento\framework\App\FrontController.php(50): Magento\Framework\App\Router\Base->match(Object(Magento\Framework\App\Request\Http))
#9 [internal function]: Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#10 C:\xampp\htdocs\magento20\vendor\magento\framework\Interception\Interceptor.php(74): call_user_func_array(Array, Array)
#11 C:\xampp\htdocs\magento20\vendor\magento\framework\Interception\Chain\Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#12 C:\xampp\htdocs\magento20\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:\xampp\htdocs\magento20\vendor\magento\module-store\App\FrontController\Plugin\RequestPreprocessor.php(89): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#14 [internal function]: Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#15 C:\xampp\htdocs\magento20\vendor\magento\framework\Interception\Chain\Chain.php(68): call_user_func_array(Array, Array)
#16 C:\xampp\htdocs\magento20\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')
#17 C:\xampp\htdocs\magento20\vendor\magento\framework\Module\Plugin\DbStatusValidator.php(69): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#18 [internal function]: Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#19 C:\xampp\htdocs\magento20\vendor\magento\framework\Interception\Chain\Chain.php(68): call_user_func_array(Array, Array)
#20 C:\xampp\htdocs\magento20\vendor\magento\framework\Interception\Chain\Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'storeCookieVali...')
#21 C:\xampp\htdocs\magento20\vendor\magento\module-store\Model\Plugin\StoreCookie.php(78): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#22 [internal function]: Magento\Store\Model\Plugin\StoreCookie->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#23 C:\xampp\htdocs\magento20\vendor\magento\framework\Interception\Chain\Chain.php(68): call_user_func_array(Array, Array)
#24 C:\xampp\htdocs\magento20\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...')
#25 C:\xampp\htdocs\magento20\vendor\magento\module-page-cache\Model\App\FrontController\VarnishPlugin.php(55): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#26 [internal function]: Magento\PageCache\Model\App\FrontController\VarnishPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#27 C:\xampp\htdocs\magento20\vendor\magento\framework\Interception\Chain\Chain.php(68): call_user_func_array(Array, Array)
#28 C:\xampp\htdocs\magento20\vendor\magento\framework\Interception\Interceptor.php(136): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#29 C:\xampp\htdocs\magento20\vendor\magento\module-page-cache\Model\App\FrontController\BuiltinPlugin.php(68): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#30 [internal function]: Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#31 C:\xampp\htdocs\magento20\vendor\magento\framework\Interception\Interceptor.php(141): call_user_func_array(Array, Array)
#32 C:\xampp\htdocs\magento20\var\generation\Magento\Framework\App\FrontController\Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#33 C:\xampp\htdocs\magento20\vendor\magento\framework\App\Http.php(115): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#34 C:\xampp\htdocs\magento20\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\Http->launch()
#35 C:\xampp\htdocs\magento20\index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#36 {main}";s:3:"url";s:34:"/magento20/Module1/index/index";s:11:"script_name";s:20:"/magento20/index.php";}