Not a specific Yii Problem, just a question about designing a base - TopicsExpress



          

Not a specific Yii Problem, just a question about designing a base and performance: Possibility one: Table users: - id int pk - status int Table status: - id int pk - name varchar(50) in code: $user->status = 1; //active Possibility two: Table users: - id int pk - status varchar(50) Instead of a second table, I have a interface here with just constants class UserStatusInterface const STATUS_ACTIVE = active; const STATUS_INACTIVE = inactive; in code: $user->status = UserStatusInterface::STATUS_ACTIVE; In the second possibility there is no need for an extra table, but there is more data in database (strings). Its also possible in search, and also, you can do User::findOne([status => UserStatusInterface::STATUS_ACTIVE]); It would also work with joining Tables if there is a hasMany(), not hasOne() relation. Is the second possibility much more slower than possibility one? In my current project i need about 30 interfaces or tables like this example. What would you prefer and why? Last Possibility: class UserStatusInterface const STATUS_ACTIVE = 1; const STATUS_INACTIVE = 2; Maybe, the best way?
Posted on: Sun, 02 Nov 2014 21:01:43 +0000

Trending Topics



Recently Viewed Topics




© 2015