Hi guys

I had some troubles with a simple self join. My first attempt was
something like that (simplified):

$c = new Criteria();
$c->addAlias('A', TestPeer::TABLE_NAME);
$c->addAlias('B', TestPeer::TABLE_NAME);
$c->addJoin(TestPeer::alias('B', TestPeer::TO_ID),
TestPeer::alias('A', TestPeer::FROM_ID));

When I executed this query a PropelException is thrown and the
generated SQL looks like this

SELECT ..... from test A, test B WHERE B.TO_ID=

Yes, the right side of the join is missing!


After a while I switched the two columns in the join and it worked
perfectly.

$c = new Criteria();
$c->addAlias('A', TestPeer::TABLE_NAME);
$c->addAlias('B', TestPeer::TABLE_NAME);
$c->addJoin(TestPeer::alias('A', TestPeer::FROM_ID),
TestPeer::alias('B', TestPeer::TO_ID));

SELECT ..... from test A, test B WHERE A.FROM_ID = B.TO_ID

For me it looks like that the definition of an alias sticks together
with the addJoin, but for what reason?
Does any of you know if this behavior has a reason or is it maybe just
a bug?

Greetz
Andy
--~--~---------~--~----~------------~-------~--~----~
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