Answer the question
In order to leave comments, you need to log in
Is it possible to specify join at the end of each query through the model?
There is a database, it contains information about goods. Goods have a manufacturer.
The connection between the product and the manufacturer is carried out through an intermediate table.
Task: display products of a certain manufacturer only. Everything is complicated by the fact that there are a lot of queries to the product table and they are scattered throughout the project, and some of them already contain different joins.
Tried to make my own ActiveQuery
class ProductQuery extends ActiveQuery
{
public function init()
{
$this->innerJoin('product_properties', 'product.id = product_properties.product_id')
->innerJoin('property_value', 'property_value.id = product_properties.property_value_id')
->andWhere(['property_value.name' => 'Лунный свет (Испания)']);
return parent::init(); // TODO: Change the autogenerated stub
}
}
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