dtjo51649 2017-02-14 13:59
浏览 61

安装过程中出错:di:compile - 不兼容的参数类型

I'm getting following errors on running setup:di:compile in my magento 2.

Incompatible argument type: Required type: \Magento\Catalog\Model\ProductTypes\ConfigInterface. Actual type: array;

Incompatible argument type: Required type: \Magento\Wishlist\Model\WishlistFactory. Actual type: array;

Code responsible for the error is as follows

    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);
}

And

    public function __construct(
    \Magento\Backend\Block\Context $context,
    \Magento\Catalog\Model\ProductTypes\ConfigInterface $typeConfig,
    array $data = []
) {
    parent::__construct($context, $data);
    $this->typeConfig = $typeConfig;
}

In my Layout I'm calling like this

        <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>  

Thanks in Advance

  • 写回答

4条回答 默认 最新

  • dsce23640 2017-02-15 11:09
    关注

    maybe a stupid question but did you clear magento cache before executing your command ?

    I also had issues when updating __construct, but was fixed when clearing cache.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥15 帮我写一个c++工程