I have an interesting issue with my model relationships that I'm
attempting to figure out how to take care of in the most elegant
fashion.

Basically, I have a User model, a Profile model, and then multiple
extended Profile models (ex: AdminProfile, etc.) which have
information specific to that type of user.

The user table has a "type" column which is an enum and designates
what type of user I have.

My relationships are setup so that

User HAS ONE Profile
Profile BLEONGS TO User
AdminProfile BELONGS TO Profile
XProfile BELONGS TO Profile
YProfile BELONGS TO Profile

How can I get this extended profile information linked to my User or
Profile models on the fly? I know about bindModel and unbindModel, but
I'm not sure where best to use it.

One thing I tried was modifying the afterFind() callback for User and
Profile to grab the user type and do an extra query for the extended
information. This feels dirty, however. It also breaks scaffolding
which is kind of annoying because I'm at the beginning stages of this
project.

Any suggestions? I saw someone in another similar post mention a
factor model. I am familiar with the factory design pattern, however
I'm not familiar with how to implement it seamlessly within Cake.

Any help would be greatly appreciated :)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to