I’ve created a virtual attribute in my model
public function getCountVencidas(){
$titulo = new FinlegadoTitulo();
$parcelas = $titulo->parcelasByClienteAndStatus($this->id,'A',true);
return count($parcelas);
}
and I need to sort a gridview by this attribute, the dataProvider is as follows:
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['defaultOrder' => ['countVencidas' => SORT_DESC]],
]);
but nothing happens.
I NEED HELP!