<?php
class BlogModel extends CommonModel{
    protected $_link = array(
        'Columns'=>array(
           'mapping_type'=>BELONGS_TO,
           'class_name'=>'Columns',
           'foreign_key'=>'catid',//News表中的catid
           'as_fields'=>'colTitle,colId,colPid',
       ),

         'Comment'=>array(
           'mapping_type'=>HAS_MANY,
           'class_name'=>'Comment',
           'foreign_key'=>'bid',//与上面的外键不同？
           'mapping_fields'=>'username,email,content,inputtime',
       ),
    );
}
?>
