与PHP Active的关联表记录多对多的关系

时间:2011-12-24 22:05:52

标签: php activerecord

我有三个表,相册(id,name,desc),Categories(id,name,desc)和albums_in_categories(album_id,category_id)。目前有PHP Active Record,这里有两个类:

<?php
class Category extends ActiveRecord\Model {
    static $has_many = array(
        array("albums")
    );
}

<?php
class Album extends ActiveRecord\Model {
    static $belongs_to = array(
        array("categories")
    );
}

现在,我将如何定义关联表(albums_in_categories)以便我的关系完全设置?

0 个答案:

没有答案