I have this module enabled, and when I try to run setup:di:compile I get this error
Fatal error: Declaration of Mirasvit\Helpdesk\Ui\Component\DataProvider\FulltextFilter::apply() must be compatible with Magento\Framework\View\Element\UiComponent\DataProvider\FilterApplierInterface::apply(Magento\Framework\Data\Collection $collection, Magento\Framework\Api\Filter $filter) in /home/magento2/public_html/app/code/Mirasvit/Helpdesk/Ui/Component/DataProvider/FulltextFilter.php on line 27
This is the original Magento 2 class
namespace Magento\Framework\View\Element\UiComponent\DataProvider;
use Magento\Framework\Data\Collection\AbstractDb;
interface FilterApplierInterface
{
public function apply(AbstractDb $collection, \Magento\Framework\Api\Filter $filters);
}
And this is the extended class in module
namespace Mirasvit\Helpdesk\Ui\Component\DataProvider;
use Magento\Framework\Data\Collection\AbstractDb as DbCollection;
use Magento\Framework\Api\Filter;
class FulltextFilter implements \Magento\Framework\View\Element\UiComponent\DataProvider\FilterApplierInterface
{
protected function getFulltextIndexColumns(DbCollection $collection, $indexTable)
{
$indexes = $collection->getConnection()->getIndexList($indexTable);
foreach ($indexes as $index) {
if (strtoupper($index['INDEX_TYPE']) == 'FULLTEXT') {
return $index['COLUMNS_LIST'];
}
}
return [];
}
public function apply(DbCollection $collection, Filter $filter)
{
$columns = $this->getFulltextIndexColumns($collection, $collection->getMainTable());
if (!$columns) {
return;
}
$collection->getSelect()
->where(
'MATCH('.implode(',', $columns).') AGAINST(?)',
$filter->getValue()
);
}
}
What could be causing this issue?
Best Answer
Ryan H, Thank you for your answer, it helped me to find out the real issue,
I had Magento 2.0.7 code base on my development and Magento 2.1 on my server, so the specific core Magento file looked differnt
This is how it looked like on Magento 2.1, so I changed my module code to be look like this
and it solved the problem for me.