Yii Framework Forum: Two Models For A Single Table - Yii Framework Forum

Jump to content

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

Two Models For A Single Table two models for a single table Rate Topic: -----

#1 User is offline   smith19 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 26-November 12

Posted 08 December 2012 - 03:51 AM

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
0

#2 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,039
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 08 December 2012 - 05:32 AM

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

#3 User is offline   Mihkel. 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 12-November 12

Posted 08 December 2012 - 05:37 AM

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

#4 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,039
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 08 December 2012 - 05:44 AM

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

#5 User is offline   smith19 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 26-November 12

Posted 08 December 2012 - 08:15 AM

Thanks to all...
I would prefer the separate model approach for reason of separation of logic.

cheers

View Postalirz23, on 08 December 2012 - 05:44 AM, said:

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.

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