A simple case like this seems like it would be easy to solve, but it won't really be possible until we introduce the new query parser sometime in ORM 5. As mentioned above, the main issue is that "order by" is not currently able to reuse the already joined supplier1_, even though their paths are identical.
The difficulty stems from the current inability to safely know which levels of a path have already been joined and can be reused. It's currently more of an all or nothing shot. The new query parser has a better concept of separated "path parts" and smartly decides to create a new join when it's actually needed.
The bottom line is that this would be extremely difficult or impossible to do in ORM 4. A hacky workaround might accomplish this specific test case, but safely handling all other complex circumstances would be an issue.
|