public function searchBy($searchQuery, array $options = array(), $statementsType = null)
    {
        $query = $this->newSearchQuery($searchQuery, array(
            'status',
            'total_price',
            'created_at',
            'updated_at',
        ), $statementsType, $options);

        if (is_array($searchQuery)) {
            if (
                array_key_exists('user_uid', $searchQuery)
                || array_key_exists('user_id', $searchQuery)
            ) {
                $query->join('users', 'users.id', '=', 'orders.user_id');
            }

            if (array_key_exists('user_uid', $searchQuery)) {
                $query->where('users.uid', '=', $searchQuery['user_uid']);
            }

            if (array_key_exists('user_id', $searchQuery)) {
                $query->where('users.uid', '=', $searchQuery['user_id']);
            }
        }

        return new Collection($query);
    }
public function searchBy($searchQuery, array $options = array(), $statementsType = null)
    {
        $query = $this->newSearchQuery($searchQuery, array(
            'status',
            'total_price',
            'created_at',
            'updated_at',
        ), $statementsType, $options);

        if (is_array($searchQuery)) {
            if (
                array_key_exists('user_uid', $searchQuery)
                || array_key_exists('user_id', $searchQuery)
            ) {
                $query->join('users', 'users.id', '=', 'orders.user_id');
            }

            if (array_key_exists('user_uid', $searchQuery)) {
                $query->where('users.uid', '=', $searchQuery['user_uid']);
            }

            if (array_key_exists('user_id', $searchQuery)) {
                $query->where('users.uid', '=', $searchQuery['user_id']);
            }
        }

        return new Collection($query);
    }
public function searchBy ( $ searchQuery , array $ options = array ( ) , $ statementsType = null ) { $ query = $ this -> newSearchQuery ( $ searchQuery , array ( 'status' , 'total_price' , 'created_at' , 'updated_at' , ) , $ statementsType , $ options ) ; if ( is_array ( $ searchQuery ) ) { if ( array_key_exists ( 'user_uid' , $ searchQuery ) || array_key_exists ( 'user_id' , $ searchQuery ) ) { $ query -> join ( 'users' , 'users.id' , '=' , 'orders.user_id' ) ; } if ( array_key_exists ( 'user_uid' , $ searchQuery ) ) { $ query -> where ( 'users.uid' , '=' , $ searchQuery [ 'user_uid' ] ) ; } if ( array_key_exists ( 'user_id' , $ searchQuery ) ) { $ query -> where ( 'users.uid' , '=' , $ searchQuery [ 'user_id' ] ) ; } } return new Collection ( $ query ) ; }
Search a Order by options.

@example
$orders = Subbly::api('subbly.order')->searchBy(array(
'status' => Order::STATUS_DRAFT,
));
// OR
$orders = Subbly::api('subbly.order')->searchBy('some words');

@param array|string $searchQuery    Search params
@param array        $options        Query options
@param string       $statementsType Type of statement null|or|and (default is null)

@return \Subbly\Model\Collection

@api
Search a Order by options .