Skip to content

Commit

Permalink
Initializing shouldKeepConditions to control when to reset or not
Browse files Browse the repository at this point in the history
  • Loading branch information
rakibtg committed Aug 12, 2019
1 parent 5f3fdd4 commit e69643f
Showing 1 changed file with 29 additions and 23 deletions.
52 changes: 29 additions & 23 deletions src/traits/helpers.php
Expand Up @@ -39,33 +39,39 @@ private function init( $conf = false ) {
if ( !empty( $conf[ 'timeout' ] ) ) $timeout = (int) $conf[ 'timeout' ];
}
set_time_limit( $timeout );
// Control when to keep or delete the active query conditions. Delete conditions by default.
$this->shouldKeepConditions = false;
} // End of init()

// Init data that SleekDB required to operate.
private function initVariables() {
// Set empty results
$this->results = [];
// Set a default limit
$this->limit = 0;
// Set a default skip
$this->skip = 0;
// Set default conditions
$this->conditions = [];
// Or conditions
$this->orConditions = [];
// In clause conditions
$this->in = [];
// notIn clause conditions
$this->notIn = [];
// Set default group by value
$this->orderBy = [
'order' => false,
'field' => '_id'
];
// Set the default search keyword as an empty string.
$this->searchKeyword = '';
// Disable make cache by default.
$this->makeCache = false;
if(!$this->shouldKeepConditions) {
// Set empty results
$this->results = [];
// Set a default limit
$this->limit = 0;
// Set a default skip
$this->skip = 0;
// Set default conditions
$this->conditions = [];
// Or conditions
$this->orConditions = [];
// In clause conditions
$this->in = [];
// notIn clause conditions
$this->notIn = [];
// Set default group by value
$this->orderBy = [
'order' => false,
'field' => '_id'
];
// Set the default search keyword as an empty string.
$this->searchKeyword = '';
// Disable make cache by default.
$this->makeCache = false;
// Control when to keep or delete the active query conditions. Delete conditions by default.
$this->shouldKeepConditions = false;
}
} // End of initVariables()

// Initialize the auto cache settings.
Expand Down

0 comments on commit e69643f

Please sign in to comment.