Understanding why each table now has a set of 2 files in the model directory


After using Yii1 for some time now, I am starting to familiarize myself with Yii2. I see that Gii now creates to files

for each table model. The second having to do with searching.

Can someone explain the reason behind this change from Yii1 to Yii2, and what advantages their are for this change.



There could be 2+ searches for the same model that are working differently. This separation is to prevent having too much not really model code in the model.

First thank you for your quick response and great explanation. So now the search function that was part of the model class in Yii1 is now in a separate model class in Yii2.

Yes. If you absolutely love 1.1 way you can move it back.