How to load an object based on unique contraint, and join with other table[s]?
I just downloaded cough, generated my classes, and now I am trying to use it. Here is my schema, simplified:
Account
------------
account_id
user_name
password
person_id
company_id
Person
---------
person_id
last_name
first_name
Company
------------
company_id
name
description
I want to find and load the account based on a user_name and company_id, which is defined as a unique contraint. That is, there will only be ONE such record since the user_name needs to be unique in a given Company. I also want the result to be a join with the Person and Company tables.
Do I need to implement a custom method to do all of this (including the SQL to perform the join)?
Not to be picky (because this is free), but it would be really helpful if someone were to post some sample code.I just can't find anything out there.
Thanks very much.
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- CoughPHP Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask George Kustas for more information if necessary.