Big project on Yii1.
They worked with the same type of products and suddenly they needed a new type of product.
We decided to add a new type field to the product table.
The problem is that the project has scattered requests of type Product::model()->findAll($criteria);
, and the current queries that are “joining” the product table, and many, many other different requests to the product. And we need that now there would never be requests to the product without specifying the type of product.
The first option is to search the entire project for all requests to the product and add a condition in which we specify the type. And then all the time to keep in mind that the request should be with the indication type.
Perhaps somehow you can use scope, but for now I can’t figure out how to apply it here. You can make the defaultScope with the default type, which will apply to all requests and a pair of scope'ov, which will cancel the actions defaultScope and add their own conditions.
Maybe someone solved similar problems? Tell me how you can do?