1.
$table->enableLinks(); //激活所有关联
$table->enableLink('mappingName'); //激活单个关联
2.关联操作:
$tableTags =& $tablePosts->getLinkTable('tags');
$link =& $tableTags->getLink('posts');
$link->fields = array('post_id', 'title', 'created');
$link->limit = 10;
$tablePosts->assembleRecursionRow('tags', $post);//
功能就是用 Table_Posts 对象的 tags 关联对应的 Table_Tags 对象查询 Table_Tags 对象的关联数据(我也晕了 -_-#),如
文章a的
分类tag为小说,当我们点击小说这个tag时,就可以查出小说下的
其他文章了
(
http://www.fleaphp.org/bbs/viewthread.php?tid=1878&highlight=assembleRecursionRow)
其中:$tableTags得到类似如下的结构:
Table_Resume Object
(
[tableName] => employ_resume
[primaryKey] => emre_id
[schema] =>
[fullTableName] => employ_resume
[hasOne] =>
[belongsTo] =>
[hasMany] =>
[manyToMany] =>
[meta] => Array
(
.........
..........