标签:
我创建了上市和它的正常工作与数据库。
现在我正在努力打造“添加表”了点。
{文件夹路径} \ magento2 \程序\代码\自定义\模块\控制器\ Adminhtml \文章\ NewAction.php
namespace Custom\Module\Controller\Adminhtml\Posts;
use Magento\Framework\View\Result\PageFactory;
use Magento\Framework\App\Action\Context;
class NewAction extends \Magento\Framework\App\Action\Action {
/**
* @var \Magento\Framework\Controller\Result\ForwardFactory
*/
protected $resultPageFactory;
/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory
*/
public function __construct(
\Magento\Framework\App\Action\Context $context, \Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
/**
* {@inheritdoc}
*/
protected function _isAllowed() {
return $this->_authorization->isAllowed(‘Custom_Module::save‘);
}
/**
* Forward to edit
*
* @return \Magento\Backend\Model\View\Result\Forward
*/
public function execute() {
/** @var \Magento\Backend\Model\View\Result\Forward $resultForward */
$resultForward = $this->resultForwardFactory->create();
return $resultForward->forward(‘edit‘);
}
}
它给下面的错误。
1例外(S):异常#0(例外):恢复错误:传递给自定义\模块\控制器\ Adminhtml \文章\ NewAction :: __结构(参数1)必须是Magento的\框架\ APP \行动\上下文的实例,没有给出称为{文件夹路径} \ magento2名称\ var \代\在线14的自定义\模块\控制器\ Adminhtml \文章\ NewAction \ Interceptor.php和{文件夹路径} \ magento2 \程序\代码\自定义\模块\控制器\ Adminhtml \文章\ NewAction.php第20行
标签:
原文地址:http://www.cnblogs.com/magento-maijindou/p/5885846.html