我得到以下運行設置錯誤:迪:編譯我的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