December 8, 2012, 8:51am
Can i have 2 models for a single table in YII.
I have a table which is storing login and registration info in one table.However i have 2 forms. One for login and one for registration. so i want to create 2 models, for login and registration.
I do agree that we need 2 tables, login and registration.
However in case if i want to do, is it possible to have 2 models pointing to single table?
Thanks to all
December 8, 2012, 10:32am
yes you can have two models but an easy aproach would be use one single model and have to different actions one for registration one for login.
December 8, 2012, 10:37am
Yes, I’ve used the default login and created user model to control creation, updating etc. Just configure default login to use your own authentication and implement sql to get user data.
December 8, 2012, 10:44am
ok if you have that in place create another action in your controller for you registration and handle your registion in that action simple solution. But you can still create a separate model for registration if thats what you want.
December 8, 2012, 1:15pm
Thanks to all…
I would prefer the separate model approach for reason of separation of logic.