2017-10-13 96 views
0

下面我有錯誤,同時運行Magento的2:編譯不兼容的參數類型時出錯

PHP斌/ Magento的設置:迪:編譯

Errors during compilation: 
     Ves\Blog\Model\ResourceModel\Author\Grid\Collection 
       Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface. Actual type: \Magento\Store\Model\StoreManagerInterface; File: 
app/code/Ves/Blog/Model/ResourceModel/Author/Grid/Collection.php 

新村/博客/型號/ ResourceModel /作者/表格/ Collection.php

namespace Ves\Blog\Model\ResourceModel\Author\Grid; 

use Magento\Framework\Api\Search\SearchResultInterface; 
use Magento\Framework\Search\AggregationInterface; 
use Ves\Blog\Model\ResourceModel\Author\Collection as AuthorCollection; 

class Collection extends AuthorCollection implements SearchResultInterface 
{ 
protected $aggregations; 
public function __construct(
     \Magento\Framework\Data\Collection\EntityFactoryInterface $entityFactory, 
     \Psr\Log\LoggerInterface $logger, 
     \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, 
     \Magento\Framework\Event\ManagerInterface $eventManager, 
     \Magento\Store\Model\StoreManagerInterface $storeManager, 
     $mainTable, 
     $eventPrefix, 
     $eventObject, 
     $resourceModel, 
     $model = 'Magento\Framework\View\Element\UiComponent\DataProvider\Document', 
     $connection = null, 
     \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null 
    ) { 
     parent::__construct(
      $entityFactory, 
      $logger, 
      $fetchStrategy, 
      $eventManager, 
      $storeManager, 
      $connection, 
      $resource 
     ); 
     $this->_eventPrefix = $eventPrefix; 
     $this->_eventObject = $eventObject; 
     $this->_init($model, $resourceModel); 
     $this->setMainTable($mainTable); 
    } 

編輯1: \程序\代碼\新村\博客\型號\ ResourceModel \作者\ Collection.php

<?php 
namespace Ves\Blog\Model\ResourceModel\Author; 

class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection 
{ 

    protected function _construct() 
    { 
     $this->_init('Ves\Blog\Model\Author', 'Ves\Blog\Model\ResourceModel\Author'); 
    } 

} 

請讓我知道如何解決這個問題。

回答

0

檢查類的結構:AuthorCollection。它似乎不支持; \ Magento的\店\型號\ StoreManagerInterface;但需要一個\ Magento \ Framework \ DB \ Adapter \ AdapterInterface對象。所以,當你調用類的構造,AuthorCollection你應該完全一樣的類型

共享使用你的類AuthorCollection,所以我可以幫你

+0

與筆者收集更新的問題。 – Palanikumar

相關問題