porton
porton

Reputation: 5805

Updating the existing model with Model Generator

I generate model with Model Generator and then (afterward) add a new table and new foreign keys relations.

Is it possible to update the existing model with model generator?

Or do I need to edit the code manually when I add a new table?

Upvotes: 1

Views: 132

Answers (2)

schmunk
schmunk

Reputation: 4708

Have a look at the gii-template-collection and it's FullModel template.

It generates by default two classes for your models, BaseModel and Model. Best-practice for me is to add my custom functions, behaviors, scopes, etc... to Model and leave BaseModel untouched.

If you have changes in your database schema, just re-generate the BaseModel class.

Upvotes: 3

Preetam
Preetam

Reputation: 618

No you can't edit the existing model with Gii tool. You will have to either manually update the model or generate a new one.

Upvotes: 2

Related Questions