我得到以下运行设置错误:迪:编译我的Magento 2.错误:迪:编译 - 不兼容的参数类型
不兼容的参数类型:必需类型:\ Magento的\目录\型号\ ProductTypes \ ConfigInterface。实际类型:数组;
不兼容参数类型:必需类型:\ Magento \ Wishlist \ Model \ WishlistFactory。实际类型:数组;
代码负责的错误如下
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Backend\Model\Session\Quote $sessionQuote,
\Magento\Sales\Model\AdminOrder\Create $orderCreate,
PriceCurrencyInterface $priceCurrency,
\Magento\Wishlist\Model\WishlistFactory $wishlistFactory,
\Magento\GiftMessage\Model\Save $giftMessageSave,
\Magento\Tax\Model\Config $taxConfig,
\Magento\Tax\Helper\Data $taxData,
\Magento\GiftMessage\Helper\Message $messageHelper,
StockRegistryInterface $stockRegistry,
StockStateInterface $stockState,
array $data = []
) {
$this->_messageHelper = $messageHelper;
$this->_wishlistFactory = $wishlistFactory;
$this->_giftMessageSave = $giftMessageSave;
$this->_taxConfig = $taxConfig;
$this->_taxData = $taxData;
$this->stockRegistry = $stockRegistry;
$this->stockState = $stockState;
parent::__construct($context, $sessionQuote, $orderCreate, $priceCurrency, $data);
}
而且
public function __construct(
\Magento\Backend\Block\Context $context,
\Magento\Catalog\Model\ProductTypes\ConfigInterface $typeConfig,
array $data = []
) {
parent::__construct($context, $data);
$this->typeConfig = $typeConfig;
}
在我的布局,我打电话这样
<block class="MyVendor\MyModule\Block\Adminhtml\Quote\Create\Items" template="Magento_Sales::order/create/items.phtml" name="items">
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Items\Grid" template="Magento_Sales::quote/create/items/grid.phtml" name="items_grid">
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Coupons" template="Magento_Sales::order/create/form.phtml" name="coupons">
<block class="Magento\Sales\Block\Adminhtml\Order\Create\Coupons\Form" template="Magento_Sales::order/create/coupons/form.phtml" name="form" />
</block>
</block>
</block>
在此先感谢
错误消息说明了自己:您键入提示某个类型/合同,但是当您调用方法/构造函数时,您提供了一个数组作为参数。 您应该发布调用代码以提供一些上下文。 – jojonas
@jojonas更新问题 – sree