8

我正在使用 cakephp V2.0.2

我遇到了麻烦

$this->paginate = array(
                "fields" => array(
                    "Player.join_country"
                ),
                "joins" => array(
                    array(
                        "table" => "banner_key_current_ext",
                        "alias" => "BannerKeyCurrentExt",
                        "type" => "inner",
                        "conditions" => "BannerKeyCurrentExt.banner_key_id = BannerKeyCurrent.banner_key_id"
                    ),
                    array(
                        "table" => "players",
                        "alias" => "Player",
                        "type" => "inner",
                        "conditions" => "BannerKeyCurrentExt.identifier = Player.zban_player_id" . $country_condition
                    ),
                    array(
                        "table" => "users",
                        "alias" => "User",
                        "type" => "inner",
                        "conditions" => "BannerKeyCurrent.user_id = User.user_id"
                    ),
                    array(
                        "table" => "tag_links",
                        "alias" => "TagLinks",
                        "type" => "inner",
                        "conditions" => "TagLinks.id = BannerKeyCurrent.user_id AND TagLinks.tag_id = 710"
                    )
                ),
                "conditions" => array(
                    "BannerKeyCurrent.date BETWEEN ? AND ?" => array(
                        $this->request->query["period_from"],
                        $this->request->query["period_to"]
                    ),
                    "BannerKeyCurrent.plan_id" => $brands_plan_map[$this->request->query["brand"]]["plans"],
                    "BannerKeyCurrent.operation_id" => $operation_ids
                ),
                "group" => array( "Player.join_country" ),
                "order" => array(
                    "Player.join_country" => "DESC"
                ),
                "limit" => 999999,
                "maxLimit" => 999999
            );

一切都适用于所有领域,加入,组,限制没有问题,但简单的订购不会起作用。输出 sql_dump 元素表明它从未添加到查询中。

任何帮助将不胜感激。

谢谢

4

3 回答 3

9

通过做

"order" =>  "Player.join_country DESC" 

为我工作。

我希望它也能帮助你。

于 2013-09-12T07:00:01.890 回答
0

尝试:

$this->Paginator->settings = array(
    "fields" => array(
                "Player.join_country"
            ),
            "joins" => array(
                array(
                    "table" => "b...

$pagedResults = $this->paginate('YourModel');
于 2012-10-23T14:46:40.193 回答
0

url中的参数是否有任何分页顺序?

分页器将使用 url 中指定的任何内容覆盖查询中的任何 order by(因此排序列标题起作用)。

如果 order 参数引用了一个无效字段,那么在从查询中删除您的 order by 并准备在 url 中添加一个之后,cake 可能会忽略它。

于 2012-10-23T16:09:53.987 回答