Есть своя ActiveQuery
class ValueQuery extends ActiveQuery
{
public function forProduct($product_id): ValueQuery
{
return $this->andWhere(['product_id' => $product_id]);
}
public function forCharacteristic($characteristic_id): ValueQuery
{
return $this->andWhere(['characteristic_id' => $characteristic_id]);
}
}
В другой ActiveRecord Product есть геттер
public function getValuesForCard(): ActiveQuery
{
$characteristics = CategoriesCharacteristics::find()
->select('characteristic_id')
->forCategory($this->category_id)
->forList(CatCharList::ATTR_LIST_CARD)
->orderBy(["sort" => SORT_ASC]);
return Value::find()
->forProduct($this->id)
->forCharacteristic($characteristics);
}
Когда я во view вызываю $product->valuesForCard, неожиданно вместо массива моделей получаю одну модель. Почему??? как исправить?