2

This is a grid collection file.
In this i didn't get any grid issues.
According to CodingStandard it shows this warning:

----------------------------------------------------------------------
 32 | WARNING | Possible useless method overriding detected
----------------------------------------------------------------------

The warning shows from this line.

$resourceModel = \Companyname\Wallet\Model\ResourceModel\Order::class

which I declared inside the constructor.

<?php
namespace Companyname\Wallet\Model\ResourceModel\Order\Grid;

use Magento\Customer\Ui\Component\DataProvider\Document;
use Magento\Framework\Data\Collection\Db\FetchStrategyInterface as FetchStrategy;
use Magento\Framework\Data\Collection\EntityFactoryInterface as EntityFactory;
use Magento\Framework\Event\ManagerInterface as EventManager;
use Psr\Log\LoggerInterface as Logger;

class Collection extends \Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult
{
    public function __construct(
        EntityFactory $entityFactory,
        Logger $logger,
        FetchStrategy $fetchStrategy,
        EventManager $eventManager,
        $mainTable = 'sales_order_grid',
        $resourceModel = \Companyname\Wallet\Model\ResourceModel\Order::class
    ) {
        parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $mainTable, $resourceModel);
    }

    public function _renderFiltersBefore()
    {
        $this->addFieldToFilter('is_wallet_quote', 1);
        return $this;
    }
}

Anyone facing this issue and anyone knows alternative method for this?

Thanks in Advance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.