samedi 29 mars 2014

Foreign Key in 2 tables (CakePHP)


Vote count:

0




I have 3 tables: staffs, users and threads.


Both the staffs and users can create threads and a thread belongs to a user.


In thread, there is a user_id (FK - BelongsTo). The question is, How can I identify who created the thread. If I create a field called creator_id I still don't know If it's a staff or a user who created the thread.


I also tried a different approach by creating a field called creator (enum('staff', 'user)). The limitation with this method is, when I am using Thread->find(), I couldn't figure out a way to retrieve the information of the creator.


What options do I have to achieve what I want?



asked 59 secs ago






Aucun commentaire:

Enregistrer un commentaire