一对一表,关键字求解???

#1 fosf

   $condition = array('parent_id'=>$parent_id);
  $fields="categories_id,parent_id";  //这里要怎么加才能限制被关联表的字段呢
  $arr = $this->spLinker()->find($condition,'',$fields);


我看到要在模型中设置,但限制的太死,有时候想要其它的字段

 
    var $linker = array(array('type' => 'hasone', // 关联类型,这里是一对一关联
        'map' => 'detail', // 关联的标识
        'mapkey' => 'categories_id', // 本表与对应表关联的字段名
        'fclass' => 'categories_descriptionModel', // 对应表的类名
        'fkey' => 'categories_id', // 对应表中关联的字段名
        'field' => 'categories_id,categories_name,categories_dir',//这里是不是限制的太死了,有时候想要其它的字段
        'enabled' => true // 启用关联
        )


:loveliness:

2011-09-28 15:09:48

#2 jake

http://www.speedphp.com/database-verifier-switch.html

2011-09-28 15:53:45

#3 fosf

错了吧,我这是一对一表的条件
find()
不是验证。

2011-09-28 17:14:41

#4 jake

那是一个数组,直接改就行
$condition = array('parent_id'=>$parent_id);
  $fields="categories_id,parent_id";  //这里要怎么加才能限制被关联表的字段呢
  $arr = $this->linker[0]['field'] = $fields;
$arr = $this->spLinker()->find($condition,'',$fields);

2011-09-28 18:47:07