Many_Many relation

an Album(id, name)

an Image (id, userId, filename)

an AlbumImage (albumId, imageId, position)




//Album.php

public function relations()

{

    return array(

        'images' => array(self::MANY_MANY, 'Image', 'album_image(album, imageId)')

    );

}


//I want images ordered by album_image.position

$images = $album->images;




Is it possible to define a relation, that pulls all images of an album ordered by position?




public function relations()

{

    return array(

        'images' => array(self::MANY_MANY, 'Image', 'album_image(album, imageId)'), 'order' => 'position', 'together' => true

    );

}



thanx mbi :slight_smile:

Question is now: how can I access the position column?

I can see that is a old post. Have you manged to acces the position column?