Manage relation with order column

Hi all, i’m new to yii and I’ve got something I want to do, but don’t know exactly how.

I’ve got two database tables : Post and Category, and one join-table PostCategory, which had an ‘order’ column.

What I want to do is to be able to manage the list of category for one post. I want to :

  • see the actual list in the right order

  • be able to add one (with a new order, the last one+1)

  • be able to remove the last one (and only the last one)

  • the new one I want to add will display the list of categories minus the ones already linked

All in the same page.

If possible, doing this in ajax would be marvelous but it’ not the main goal ^^

I’ve tried some things, done some search, seen some extensions but I don’t know exactly :

  • if I have to use the many-many relation or a double has-many

  • if I have to manage that on the Post-views or in the PostCategories-views

  • if an extension can help me to do that

  • if yii manage order for me, instead of doing it manually

Somebody has already done or seen that ?

Thanks in advance