So i have a controller to access form with structure like this:
Controller>Adminhtml>Preferences>NewAction.php
but when i try to acces /preferences/new, it gives me an error like this:
Fatal error: Uncaught TypeError: Argument 1 passed to Lime\Courier\Controller\Adminhtml\Preferences\NewAction::__construct() must be an instance of Magento\Backend\App\Action\Context, instance of Magento\Framework\ObjectManager\ObjectManager given, called in C:\xampp7\htdocs\magento2\vendor\magento\framework\ObjectManager\Factory\AbstractFactory.php on line 93 and defined in C:\xampp7\htdocs\magento2\app\code\Lime\Courier\Controller\Adminhtml\Preferences\NewAction.php:16 Stack trace: #0
here's my controller NewAction.php:
namespace Lime\Courier\Controller\Adminhtml\Preferences;
class NewAction extends \Lime\Courier\Controller\Adminhtml\Preferences
{
protected $resultForwardFactory;
/**
* @param \Magento\Backend\App\Action\Context $context
* @param \Magento\Framework\Registry $coreRegistry
* @param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
*/
public function __construct(
\Magento\Backend\App\Action\Context $context,
\Magento\Framework\Registry $coreRegistry,
\Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
) {
$this->resultForwardFactory = $resultForwardFactory;
parent::__construct($context, $coreRegistry);
}
/**
* New action
*
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
/** @var \Magento\Framework\Controller\Result\Forward $resultForward */
$resultForward = $this->resultForwardFactory->create();
return $resultForward->forward('edit');
}
}
var/generation
folder?php bin/magento setup:di:compile