Question about controller create by CRUD

I’m a newbie at using frameworks and i have a question.

What does “new User(‘search’);” do? I don’t understand the use of the ‘search’ argument.


	 * Manages all models.


	public function actionAdmin()


		$model=new User('search');







Thanks in advance.

It initializes the ‘scenario’ property to ‘search’ instead of the default ‘insert’. See also:

I’m not sure about the reason, but the effect would be that all the searchable attributes can be massively assigned in the statement



Thanks for the explanation but im having a hard time understanding what scenarios are.

I have read the documentation “Creating a Model” and search in google about it and i still don’t get it.

seems i jumped one line in my reading about scenarios ;D


$model=new LoginForm;




so, to define a scenario is just like that? Seems easy. :lol:

Sorry again for the dumb questions…i’m new to the framework field (ANY FRAMEWORK ;D )