Declaring MANY_MANY Relationships

When declaring many-to-many relationships in the Model::relations() method, does the order in which the composite foreign keys are declared matter?

In other words, if you have two entities, Post and Category, with posts having many categories and vice-versa, is it necessary to switch the order in which the two keys appear in the relationship declaration, like this?




/* Post relations */

    public function relations()

    {

        return array(

            'categories'=>array(self::MANY_MANY, 'Category',

                'tbl_post_category(post_id, category_id)'),

        );

    }


/* Category relations */

    public function relations()

    {

        return array(

            'posts'=>array(self::MANY_MANY, 'Post',

                'tbl_post_category(category_id, post_id)'),

        );

    }



Or should the same foreign key always appear first, like this?




/* Post relations */

    public function relations()

    {

        return array(

            'categories'=>array(self::MANY_MANY, 'Category',

                'tbl_post_category(post_id, category_id)'),

        );

    }


/* Category relations */

    public function relations()

    {

        return array(

            'posts'=>array(self::MANY_MANY, 'Post',

                'tbl_post_category(post_id, category_id)'),

        );

    }



I am pretty sure I have seen examples of both variations around here. Will the order of the keys here affect code execution?

Thanks!

Oh yeah, I almost forgot: what is the correct syntax for declaring relationships between models on either side of a MANY_MANY relationship (like Post or Category in my previous post) and the model representing the associative table?