<?php

namespace FiloBlu\Refilo\Model\ResourceModel\Product;

class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection {

    /**
     * Fix add configurable products to grouped product
     * @see \Magento\GroupedProduct\Ui\DataProvider\Product\GroupedProductDataProvider::getData
     *
     * @param $attribute
     * @param $condition
     * @param $joinType
     * @return $this|Collection
     */
    public function addAttributeToFilter($attribute, $condition = null, $joinType = 'inner')
    {
        if($attribute === 'required_options') {
            return $this;
        }
        return parent::addAttributeToFilter($attribute, $condition, $joinType);
    }
}
