有关联,又有分页怎么办?(已解决)

#1 okbb

$this->results = $guestbook->spPager($this->spArgs('page', 1), 5)->spLinker()->findAll(); 


这样写,分页不出来。

2010-08-09 23:34:47

#2 jake

反过来即可

$this->results = $guestbook->spLinker()->spPager($this->spArgs('page', 1), 5)->findAll();

2010-08-10 09:40:21

#3 okbb

不行呀,原来 可以dump出关联的查询,只是没分页
Array
(
    [0] => Array
        (
            [tvjid] => 5
            [title] => 剧5
            [time] => 0000-00-00
            [profile] => 5
            [who] => Array
                (
                    [0] => Array
                        (
                            [tvyid] => 2
                            [title] => 李四
                            [profile] => 123
                        )

                    [1] => Array
                        (
                            [tvyid] => 3
                            [title] => 王五
                            [profile] => 5555
                        )

                )

        )

    [1] => Array
        (
            [tvjid] => 6
            [title] => 剧6
            [time] => 2010-08-07
            [profile] => 6
            [who] => Array
                (
                    [0] => Array
                        (
                            [tvyid] => 2
                            [title] => 李四
                            [profile] => 123
                        )

                    [1] => Array
                        (
                            [tvyid] => 3
                            [title] => 王五
                            [profile] => 5555
                        )

                    [2] => Array
                        (
                            [tvyid] => 5
                            [title] => 李6
                            [profile] => 6
                        )

                )

        )

)
反过来,有分页,但是dump不出关联的数据,只有一层array
Array
(
    [0] => Array
        (
            [tvjid] => 5
            [title] => 剧5
            [time] => 0000-00-00
            [profile] => 5
            
        )

    [1] => Array
        (
            [tvjid] => 6
            [title] => 剧6
            [time] => 2010-08-07
            [profile] => 6
      

        )

)

2010-08-10 10:55:02

#4 jake

对了,使用最新的sp框架

2010-08-10 11:37:01