Question on model object creation

Hello,

When you create a new model object, for an example :

$model = new MyCustomModel(‘search’);

I don’t quite understand the functionality in the parenthesis and the word ‘search’. What is it’s use?

It is called “scenario”. See Working with Forms: Creating Model | The Definitive Guide to Yii 1.1 | Yii PHP Framework

1 Like

So this scenario executes a query?

This adds to the explanation
https://www.yiiframework.com/doc/api/1.1/CModel#scenario-detail

1 Like