cakephp旁路从$ _GET改变

时间:2013-12-23 17:16:13

标签: cakephp

我有一个分页问题,​​其中分页数组如下所示:

Array
(
[fields] => Array
    (
        [0] => DISTINCT Product.*
        [1] => ProductImage.*
        [2] => ProductStore.*
        [3] => ProductStore.retail_level_1 AS priceyprice
        [4] => Product.bestseller AS bestybest
        [5] => Product.inserted_date AS insertysert
        [6] => (CASE WHEN `Product`.`title` LIKE '%dog%' THEN 2 ELSE 0 END) AS exact
        [7] => (CASE WHEN `Product`.`alias` LIKE '%dog%' THEN 1 ELSE 0 END) AS alias
    )

[order] => Array
    (
        [0] => priceyprice ASC
    )

[conditions] => Array
    (
        [Product.product_type] => Array
            (
                [0] => 0
                [1] => 1
                [2] => 3
            )

        [OR] => Array
            (
                [0] => Array
                    (
                        [0] => Product.title LIKE "%dog%"
                        [1] => Product.title LIKE "%dogs%"
                        [2] => Product.title LIKE "%dog%"
                        [3] => Product.alias LIKE "%dogs%"
                        [4] => Product.alias LIKE "%dog%"
                    )

                [1] => Array
                    (
                        [Product.title LIKE] => %dog%
                    )

                [2] => Array
                    (
                        [Product.description LIKE] => %dog%
                    )

                [3] => Array
                    (
                        [0] => Product.id IN (285,334)
                    )

                [4] => Array
                    (
                        [Product.title LIKE] => %dog%
                    )

                [5] => Array
                    (
                        [Product.description LIKE] => %dog%
                    )

                [6] => Array
                    (
                        [0] => Product.id IN (285,334,285,334)
                    )

            )

    )

[recursive] => -1
[joins] => Array
    (
        [0] => Array
            (
                [table] => product_attribute_values
                [type] => left
                [foreignKey] => 
                [conditions] => Array
                    (
                        [0] => product_attribute_values.product_id = Product.id
                    )

            )

        [1] => Array
            (
                [table] => product_images
                [alias] => ProductImage
                [type] => left
                [foreignKey] => 
                [conditions] => Array
                    (
                        [0] => ProductImage.product_id = Product.id
                        [1] => ProductImage.default = 1
                    )

            )

        [2] => Array
            (
                [table] => product_stores
                [alias] => ProductStore
                [type] => left
                [foreignKey] => 
                [conditions] => Array
                    (
                        [0] => ProductStore.product_id = Product.id
                        [1] => ProductStore.store_id = 1
                    )

            )

    )

[limit] => 12
)

然而,这会生成一个查询,它只是忽略sql部分的顺序。但是,当数组中的以下内容时,原始查询会按顺序排序:

 [order] => Array
    (
        [0] => exact DESC
        [1] => alias DESC
    )

原始阵列是由效率低下的电子商务系统自动生成的。我试图使用$ _GET动态更改查询。

有人可以告诉我是否需要更改ordeer中的其他地方以重新调整我的SQL,因为我的分页数组中的更改只是被忽略....

0 个答案:

没有答案