2007/9/27, Simon Roby <[EMAIL PROTECTED]>:
>
>
> On 9/27/07, Dan Grossman <[EMAIL PROTECTED]> wrote:
> >
> > When you're talking about MySQL, adding a WHERE clause on the foreign
> > key is almost always identical to performing an inner join. I don't see
> > this behavior as incorrect at all. A left outer join is never the
> > default join type, so it *should* have to be explicitly specified.
>
> The incorrect behavior I'm talking about is that the doSelectJoin()
> methods are NOT using a left join when resolving foreign keys.
>
> Example: You want to fetch all Foo objects from the database, as well
> as all Bar objects referenced by those Foo objects through a foreign
> key, so you use FooPeer::doSelectJoinBar() with an empty Criteria as
> parameter. Logically you'd expect all Foo objects to be returned,
> however any Foo objects having a NULL in the foreign key field will be
> discarded from the result!
> --
> - SR


I've no tested it, but have you tried:

$c->addJoin(FooPeer::BAR_ID, BarPeer::ID, Criteria::LEFT_JOIN);

and pass this criteria to the doSelectJoinBar method?

Anyway, I agree with Dan, the default join is a inner join, so it's normal
that the Foo objects that don't have any Bar_ID set, are descarted. If you
want them, you've to do a LEFT JOIN explicitly. Moreover, this is not a
directly related symfony question, it's better to ask in the propel mailing
list (just a thought).

Cheers,

Marc

-- 
"I'm unique, just like everyone else". Read it out there

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
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