Answer the question
In order to leave comments, you need to log in
The own implementation of ActiveQuery does not work correctly. Why?
Has its own 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]);
}
}
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);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question