I did not find this bug already, perhaps I did not see it? It seems very obvious to me.
The automatically generated doSelectJoinAll- and doSelectJoinExcept..-methods in Peer-classes will fail if the same table has to be joined several times.
For example:
Given table message with sender_id and recipient_id, both foreign keys of table user with primary key id.
MessagePeer::doSelectJoinAll() should select the message, the user that is the sender and the user that is the recipient of the message. But it fails, because Propel does something like:
SELECT ... FROM message,user WHERE user.id=message.recipient_id AND user.id=message.sender_id
...but it is very seldom that the sender and the reciever of a message is the same user. The correct solution in this case would be:
SELECT ... FROM message, user AS A, user AS B WHERE A.id=message.recipient_id AND B.id=message.sender_id
Used versions: PHP5.0, MySQL 4.1, Propel 1.1