Majiameng/yii2-solr problem with dataprovider

I’m trying to use majiameng/yii2-solr in a dataprovider.

$query = GroupSolrCollection::find();
$dataProvider = new ActiveDataProvider([
    'query' => $query,
    'pagination' => ['pageSize'=>10],
    'sort' => false,
]);        

return $dataProvider;

It works fine as an ActiveRecord query, but when fed into a dataprovider, gives the error:

Solr ActiveQuery Cancellation function :count

That is caused by the last line here (yii2-solr/src/ActiveQuery.php):

/** Log out of these parent methods */
public function andWhere($condition){self::cancelFunction(__FUNCTION__);}
public function orWhere($condition){self::cancelFunction(__FUNCTION__);}
public function orFilterWhere(array $condition){self::cancelFunction(__FUNCTION__);}
public function filterWhere(array $condition){self::cancelFunction(__FUNCTION__);}
public function exists($db = null){self::cancelFunction(__FUNCTION__);}
public function count($q = '*', $db = null){self::cancelFunction(__FUNCTION__);}

Apparently it’s unsetting the count function, which the dataprovider needs. Is there a way to override this? Or am I on the wrong track?

It’s a good idea to ask extension author.

I’ve done that. :slight_smile: