Does Gii Generate The 'search Model Class'?

Does Gii generate the ‘Search Model Class’?

I am stuck on the CRUD Generator since it asks for ‘Search Model Class’. I don’t know what ‘Search Model Class’ is, and I could not find it in the basic or advanced app.

Search Model Class is a class that will be generated by Gii. It represents the model behind the search form. You should enter the fully qualified class name for it (e.g. app\models\search\PostSearch)

Which Gii generator creates the Search class?

I would assume it should be the Model generator but my model generator is only generating the model.

The CRUD generator.

Thanks, solved the problem by manually creating the ‘search’ folder under models.

So it is probably a small bug in the Yii2 app generator.

Is there any other way to create the Search Model Class without CRUD with gii, for example I have to type manually my MOdel Search Class of a Model that reference a database view, because it isn’t necessary to generate a CRUD of a database view.

A Model based on a database view could be generated by Gii’s Model Generator, by giving it the name of a view instead of a table name.

You don’t have to manually added a folder for the search model. It’s basically another model which can go in your models folder. I generally just type the same namespace where my model is and add the suffix Search to the model name. Maybe if you want to have things organized you could have a separate folder but the search model is just another model that extends from the original model, therefore just another model that can go in the models folder. ;)