my model is basically in common/models, so I feel that frontend/models and backend/models directories are useless. Did you all use it?
my model is basically in common/models, so I feel that frontend/models and backend/models directories are useless. Did you all use it?
do not use model in direct use commom under frontend and backend. To establish model classes under frontend/models
and backend/models
, respectively, inherit common/models
, and then use.
ide/2.0/structure-models-sharpbest-practices" rel=" nofollow noreferrer "> https://www.yiichina.com/doc/...
in the advanced application template, you can define a model base classcommon\ models\ Post
, and then in the foreground application, define and use a specific model class that inheritscommon\ models\ Post
frontend\ models\ Post
. In the background application, you can similarly definebackend\ models\ Post
. Through this strategy, you know thatfrontend\ models\ Post
only corresponds to the foreground application, and if you modify it, you don't have to worry about the modification affecting the background application.
I also write it all in common/models, which is common in front and background and easy to use.