Hello, please tell me how to set up the report in such a way that the relation mapping would work with the like operator, and not where, the thing is this:
CategoryModel:
public function getProducts() { return $this->hasMany(ProductModel::className(), ['category_id' => 'id']); } public function getBrands() { return $this->hasMany(BrandModel::className(), ['id' => 'brand_id'])->via('products'); } So we get a definite list of the BrandModel model, but, not quite complete, CategoryModel has data with the field path = 3.10, as well as a list in ProductModel in which the value is path = 3.10.13, and I need to do this like this:
CategoryModel:
public function getProducts() { return $this->hasMany(ProductModel::className(), ['path' => 'path']); } And at the same time, I want to get not category_model.path = product_model.path, but category_model.path like product_model.path. Tell me please, is there a solution in this case? I would be very grateful for your attention.
The query should be: SELECT * FROM TABLE category JOIN TABLE product ON product.path LIKE '%' + category.path + '%'