I have below error while running
php bin/magento setup:di:compile
Errors during compilation:
Custom\Module\Block\BuyingListIndex
Incorrect dependency in class Custom\Module\Block\BuyingListIndex in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/BuyingListIndex.php
\Magento\Framework\Filesystem already exists in context object
\Magento\Framework\App\Config\ScopeConfigInterface already exists in context object
Custom\Module\Block\CategoryListIndex
Incorrect dependency in class Custom\Module\Block\CategoryListIndex in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/CategoryListIndex.php
\Magento\Framework\Filesystem already exists in context object
\Magento\Framework\App\Config\ScopeConfigInterface already exists in context object
Custom\Module\Block\EtradeIndex
Incorrect dependency in class Custom\Module\Block\EtradeIndex in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/EtradeIndex.php
\Magento\Framework\Filesystem already exists in context object
Custom\Module\Block\MyModule\BuyingList
Incorrect dependency in class Custom\Module\Block\MyModule\BuyingList in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/MyModule/BuyingList.php
\Magento\Framework\Filesystem already exists in context object
Custom\Module\Block\MyModule\Edit
Incorrect dependency in class Custom\Module\Block\MyModule\Edit in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/MyModule/Edit.php
\Magento\Framework\Filesystem already exists in context object
Custom\Module\Block\MyModule\EditMessage
Incorrect dependency in class Custom\Module\Block\MyModule\EditMessage in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/MyModule/EditMessage.php
\Magento\Framework\Filesystem already exists in context object
Custom\Module\Block\MyModule\Index
Incorrect dependency in class Custom\Module\Block\MyModule\Index in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/MyModule/Index.php
\Magento\Framework\Filesystem already exists in context object
Custom\Module\Block\Posts\ViewPosts
Incorrect dependency in class Custom\Module\Block\Posts\ViewPosts in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/Posts/ViewPosts.php
\Magento\Framework\Filesystem already exists in context object
\Magento\Framework\App\Config\ScopeConfigInterface already exists in context object
Custom\Module\Block\SellingListIndex
Incorrect dependency in class Custom\Module\Block\SellingListIndex in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/SellingListIndex.php
\Magento\Framework\Filesystem already exists in context object
\Magento\Framework\App\Config\ScopeConfigInterface already exists in context object
Custom\Module\Block\UserPostsListIndex
Incorrect dependency in class Custom\Module\Block\UserPostsListIndex in D:/wamp/www/smint/magento/app/code/Custom/Module/Block/UserPostsListIndex.php
\Magento\Framework\Filesystem already exists in context object
\Magento\Framework\App\Config\ScopeConfigInterface already exists in context object
Custom\Module\Model\ResourceModel\Messages\Grid\Collection
Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface. Actual type: \Magento\Store\Model\StoreManagerInterface; File:
D:/wamp/www/smint/magento/app/code/Custom/Module/Model/ResourceModel/Messages/Grid/Collection.php
Custom\Module\Model\ResourceModel\Posts\Grid\Collection
Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface. Actual type: \Magento\Store\Model\StoreManagerInterface; File:
D:/wamp/www/smint/magento/app/code/Custom/Module/Model/ResourceModel/Posts/Grid/Collection.php
Total Errors Count: 12
D:/wamp/www/smint/magento/app/code/Custom/Module/Block/BuyingListIndex.php
Code
namespace Custom\Module\Block;
class BuyingListIndex extends \Magento\Framework\View\Element\Template {
public function __construct(
\Magento\Framework\View\Element\Template\Context $context, \Custom\Module\Model\ResourceModel\Posts\CollectionFactory $collectionFactory, \Custom\Module\Model\Posts $posts, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\Image\AdapterFactory $imageFactory, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, array $data = []
) {
$this->collectionFactory = $collectionFactory;
$this->posts = $posts;
$this->_filesystem = $filesystem;
$this->_imageFactory = $imageFactory;
$this->scopeConfig = $scopeConfig;
parent::__construct($context, $data);
}
}
[UPDATE]
app\code\Custom\Module\Model\ResourceModel\Posts\Grid\Collection.php
namespace Custom\Module\Model\ResourceModel\Posts\Grid;
use Magento\Framework\Api\Search\SearchResultInterface;
use Magento\Framework\Search\AggregationInterface;
use Magento\Framework\DB\Adapter\AdapterInterface;
use Custom\Module\Model\ResourceModel\Posts\Collection as PostsCollection;
/**
* Collection for displaying grid of etrade posts
*/
class Collection extends PostsCollection implements SearchResultInterface
{
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,
\Magento\Framework\EntityManager\MetadataPool $metadataPool,
$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,
$metadataPool,
$connection,
$resource
);
$this->_eventPrefix = $eventPrefix;
$this->_eventObject = $eventObject;
$this->_init($model, $resourceModel);
$this->setMainTable($mainTable);
}
}
How to solve above complication errors?