cake 分页一个典型的条件

        $this->paginate = array(
            'limit' => $limit,
            'order' => array('MerchantProductOrder.id' => 'desc'),
            'fields' => array(
                'MerchantProductOrder.*',
                'MerchantProduct.*',
                'Merchant.*'
            ),
            'joins' => array(
                array(
                    'table' => 'media_app_order',
                    'alias' => 'MediaAppOrder',
                    'type' => 'inner',
                    'conditions' => array(
                        'MediaAppOrder.merchant_product_order_id = MerchantProductOrder.id',
                    )
                ),
                array(
                    'table' => 'merchant_products',
                    'alias' => 'MerchantProduct',
                    'type' => 'inner',
                    'conditions' => array(
                        'MerchantProduct.id = MerchantProductOrder.product_id',
                    )
                ),
                array(
                    'table' => 'merchants',
                    'alias' => 'Merchant',
                    'type' => 'inner',
                    'conditions' => array(
                        'Merchant.id = MerchantProduct.merchant_id',
                    )
                ),
            ),
            'conditions' => $conditions,
        );

包括了,字段,连接,排序,限制,条件

posted @ 2013-04-10 09:46  linksgo2011  阅读(120)  评论(0编辑  收藏  举报