I'm trying to make a rather abstract method that would execute a yii2 query depending on the attribute passed my code is:
public static function getModelosQuePodemTer($atributo) {
self::$helper = $atributo;
return self::find()
->joinWith(['modelo' => function($query) {
$query->andWhere([self::$helper => 1]);
}])
->all();
If I'm not mistaken, I can not pass another attribute on the function being called, and I think my solution is a gambiarra
I wonder if there is another way to do this