请问一对一关联时如何返回从表中指定的字段?

#1 vsxp

因表字段太多,不想全部返回。所以取主、从两表中的需要进行返回,但不知道如何表示从表中的字段。

谢谢。

2010-11-19 01:31:15

#2 jake

在关联的$linker上面,'field' => ''可以设置获取从表的字段,默认为 *
还有limit数量限制,condition附加条件,sort排序等等。
文章http://speedphp.com/post/splinker-hasone.html
的最后:
        var $linker = array(
                array(
                        'type' => 'hasmany',
                        'map' => 'ulink',
                        'mapkey' => 'user_id',
                        'fclass' => 'gb',
                        'fkey' => 'user_id',
                        'midclass' => 'user2gb',
                        'sort' => '', 'condition' => '', 'field' => '', 'limit' => '',
                        'enabled' => true, 'countonly' => false
                ),
                array(
                        ...
                )
);

2010-11-19 09:01:54