public function showUnDeleted($query)
{
// do some logic here
}
and call this method in the ActiveRecord where you attached your behavior to load un deleted records
I thought of that, but it will lead to lots of data fetched that will be discarded immediately.
My idea was to extend the Query model somehow, but I haven’t figured out if it’s possible to extend the Query without extending the Model, the ActiveRecord and the ActiveQuery aswell…
imaginary pseudocode:
public function onlyActive(){
$this->andWhere('is_deleted', null);
return $this;
}
Category::find()->where('something',$awesome)->onlyActive()->all();