I have an application that is using three "user" models, from three datasources. One is specifically built for the application (User), one is LDAP-based (NetworkAccount), and the third is a "static" database (Salesperson), in that I can only read from it. I'm also using the ACL component, which complicates things a little more.
Anyway, in the first database, I have my ACL tables and a user table. My problem is that the models based on the LDAP and static databases use a varchar "username" as their primary keys, and I can't change that. However ACL seems to require that the foreign keys in the aros table be integers. In my User model, I want to associate the corresponding models, but I can't figure out how to define the $hasOne conditions so that both the primary key in the base and the foreign key on the other side are custom. Basically if I set User.username to be the primary key, ACL fails because it can't convert the varchar to intergers in the aros table. Here is the pertinent info to make it more clear: Model User pkey = User.id (int) unique = User.username (varchar) Model NetworkAccount pkey = NetworkAccount.SAMAccountName (varchar) Model Salesperson pkey = Salesperson.Code (varchar) I know in the relation variables, you can specify a foreign key, which I have to do since neither of the other two tables have a user_id column. But can I specify the column in User that I want to match with? Obviously what I want to do is User.username = NetworkAccount.SAMAccountName and User.username = Salesperson.Code. But I haven't been able to figure out how to tell cake to use username instead of id for the relations. Hopefully that makes enough sense for someone to offer up an idea. If I can't use the built-in relation variables ($hasOne, $belongsTo), how would I go about writing custom queries that would automatically fire when a User object is created, to pull the info from the other two tables? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---