Hi.

I have just started using Doctrine in my symfony 1.2 project. I'm just 
having trouble accessing some data.

Let's say I have three tables:

   * User
   * Hub
   * UserHubRef

Each Hub can have many Users but only one owner. So I could do this in 
two ways:

   * have a field in the Hub table: owner_id (class: User)
   * or have a field in the UserHubRef table: is_owner

 From my raw SQL days, my gut instinct is to use the second option.

So far so good, I can find a list of Hubs that are associated with a 
User and a list of Users that are associated with each Hub.

But want I want to do is the following:

Hub        | Owner
-------------------------
Hub One    | John Smith
Hub Two    | Bill Clinton
Hub Three  | Madonna

So in my HubTable class, I have the following:

public function getWthOwner()
{
   $q = $this->createQuery('h')
        ->leftJoin('h.UserHubRef uhr ON uhr.is_owner = 1')
        ->leftJoin('uhr.User u');

    return $q->execute();
}

This seems to work fine, but I need to know what Hub method to call to 
get the owners.

Any suggestions?

Thanks in advance.

Tom

-- 
Tom Haskins-Vaughan
Temple Street Media: Design and Development for the Web
[email protected] | www.templestreetmedia.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to