Yii Framework Forum: Does Gii Generate The 'search Model Class'? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Does Gii Generate The 'search Model Class'?

#1 User is offline   Xavier John 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 16-August 13
  • Location:Redmond, WA

Posted 12 September 2013 - 10:13 PM

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.
1

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,907
  • Joined: 04-October 08
  • Location:DC, USA

Posted 12 September 2013 - 10:25 PM

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)
1

#3 User is offline   Xavier John 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 16-August 13
  • Location:Redmond, WA

Posted 12 September 2013 - 10:39 PM

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.
1

#4 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,907
  • Joined: 04-October 08
  • Location:DC, USA

Posted 13 September 2013 - 08:36 AM

The CRUD generator.
3

#5 User is offline   Xavier John 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 16-August 13
  • Location:Redmond, WA

Posted 13 September 2013 - 10:47 AM

View Postqiang, on 13 September 2013 - 08:36 AM, said:

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.
1

#6 User is offline   sergiorosales 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 19-September 10
  • Location:México

Posted 30 June 2017 - 10:19 AM

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.
0

#7 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 3,240
  • Joined: 16-February 11
  • Location:Japan

Posted 30 June 2017 - 11:08 AM

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.
0

#8 User is offline   natral 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 08-May 17

Posted 04 July 2017 - 04:44 PM

View PostXavier John, on 13 September 2013 - 10:47 AM, said:

Thanks, solved the problem by manually creating the 'search' folder under models.
So it is probably a small bug in the Yii2 app generator.


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. ;)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users