0

我一直试图将我的数组($conditions)转移到我的 api(@pagination_condition)。任何人都有任何线索。感谢客户代码:

$tofind = $this->request->query;
$conditions = array( `enter code here`
                        array( 
                        "TransactionInfo.created >= " => "$startDate_finder", 
                        "TransactionInfo.created <=" => "$endDate_finder" 
                        ), 
                        "OR" => array( 
                        array( "User.first_name LIKE " => "%$keyword_finder%" ),
                        array( "User.last_name LIKE " => "%$keyword_finder%" )
                        ),
                        "ORDER" => array("TransactionInfo.created" => "desc"),
                        "limit" => 30
                      );
        $response = json_decode($this->HTTPClient->get($this->apiUrl . "users/search/page:{$query}.json", $tofind."&condition="json_encode($conditions)), true);

我的api代码:

if ($this->request->is('get')) {
        $finder = $this->request->query;
        $pagination_conditions = array(
            'conditions' => null, //array('Model.field' => $thisValue), //array of conditions
            'recursive' => 1, //int
            'fields' => null, //array('Model.field1', 'DISTINCT Model.field2'), //array of field names
            'order' => null, //array('Model.created', 'Model.field3 DESC'), //string or array defining order
            'group' => null, //array('Model.field'), //fields to GROUP BY
            'limit' => null, //n, //int
            'page' => null, //n, //int
            'offset' => null, //n, //int
            'callbacks' => true, //true //other possible values are false, 'before', 'after'
        );
        $pagination_conditions = array_merge($pagination_conditions, json_decode($conditions));

我希望在客户端设置的条件数组覆盖 api 中的 pagination_condition。您的线索将不胜感激。提前致谢。

4

0 回答 0