0

I have created a backend module on magento 2.1.6 which was working fine on the mass delete action.

After upgrading magento with version 2.1.9, now if i tried to make a mass delete i receive this next err :

Uncaught Error: Call to undefined method namespace\module\Model\ResourceModel\Post\Grid\Collection::_getAllIdsSelect();

on this function:

  public function getAllIds($limit = null, $offset = null)
    {
        return $this->getConnection()->fetchCol($this->_getAllIdsSelect($limit, $offset), $this->_bindParams);
    }

Does anyone know how to solve this issue?

0

you can add this function to your namespace\module\Model\ResourceModel\Post\Grid\Collection.php :

protected function _getAllIdsSelect($limit = null, $offset = null)
{
    $idsSelect = clone $this->getSelect();
    $idsSelect->reset(\Magento\Framework\DB\Select::ORDER);
    $idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_COUNT);
    $idsSelect->reset(\Magento\Framework\DB\Select::LIMIT_OFFSET);
    $idsSelect->reset(\Magento\Framework\DB\Select::COLUMNS);
    $idsSelect->columns($this->getResource()->getIdFieldName(), 'main_table');
    $idsSelect->limit($limit, $offset);
    return $idsSelect;
}

hopefully useful for you.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.