Skip to content
This repository was archived by the owner on Feb 25, 2018. It is now read-only.

Update parseQuery.php #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 31 additions & 40 deletions parseQuery.php
Original file line number Diff line number Diff line change
@@ -24,53 +24,44 @@ public function __construct($class=''){
}

public function find(){
if(empty($this->_query)){
$request = $this->request(array(
'method' => 'GET',
'requestUrl' => $this->_requestUrl
));

return $request;

$urlParams = array();
if(!empty($this->_query)){
$urlParams['where'] = json_encode( $this->_query );
}
if(!empty($this->_include)){
$urlParams['include'] = implode(',',$this->_include);
}
if(!empty($this->_order)){
$urlParams['order'] = implode(',',$this->_order);
}
if(!empty($this->_limit) || $this->_limit == 0){
$urlParams['limit'] = $this->_limit;
}
if(!empty($this->_skip)){
$urlParams['skip'] = $this->_skip;
}
if($this->_count == 1){
$urlParams['count'] = '1';
}
else{
$urlParams = array(
'where' => json_encode( $this->_query )
);
if(!empty($this->_include)){
$urlParams['include'] = implode(',',$this->_include);
}
if(!empty($this->_order)){
$urlParams['order'] = implode(',',$this->_order);
}
if(!empty($this->_limit) || $this->_limit == 0){
$urlParams['limit'] = $this->_limit;
}
if(!empty($this->_skip)){
$urlParams['skip'] = $this->_skip;
}
if($this->_count == 1){
$urlParams['count'] = '1';
}

$request = $this->request(array(
'method' => 'GET',
'requestUrl' => $this->_requestUrl,
'urlParams' => $urlParams,
));
$request = $this->request(array(
'method' => 'GET',
'requestUrl' => $this->_requestUrl,
'urlParams' => $urlParams,
));

return $request;
}
return $request;

}
//setting this to 1 by default since you'd typically only call this function if you were wanting to turn it on
public function setCount($bool=1){
if(is_bool($bool)){
$this->_count = $bool;
}
public function setCount($bool=1){
if(is_bool($bool)){
$this->_count = $bool;
}
else{
$this->throwError('setCount requires a boolean paremeter');
$this->throwError('setCount requires a boolean paremeter');
}
}
}

public function getCount(){
$this->_count = 1;