PHP: Doctrine: order joined records
        Posted  
        
            by Sebastian Bechtel
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sebastian Bechtel
        
        
        
        Published on 2010-06-14T11:21:01Z
        Indexed on 
            2010/06/16
            11:32 UTC
        
        
        Read the original article
        Hit count: 234
        
Hi,
I'm new to doctrine: I have a problem with the sorting of joined records.
A sample.
I've got an Article model which is associated with a Source model in 1 <-> n. The source model has a property called 'position' with an integer value.
Now I want to fetch an article with it's sources orderes by the position. My DQL looks like this:
$q = Doctrine_Query::create()
  ->select('a.title, s.content')
  ->from('Article a')
  ->leftJoin('a.Source s')
  ->where('a.id = ?')
  ->orderBy('s.position');
The result doesn't change if I edit the position.
Best regards, Sebastian
© Stack Overflow or respective owner