- Bugfixes done linked to SearchRequest and Searchable features.

- Fixed a bug introduced into PdoObject exception on latest commit.
- Corrected the open() close() enclosure of query condition.
This commit is contained in:
mcndave committed 2020-03-31 13:24:15 -04:00
1 parent f98cb2ded0
commit 84da4dbb7b
9 files changed
+111 -20

No files matched your search

+16 -4
View File
@@ -5,7 +5,7 @@ namespace Ulmus;
class QueryBuilder
{
public Query\Where $where;
/**
* Those are the parameters we are going to bind to PDO.
*/
@@ -139,7 +139,13 @@ class QueryBuilder
public function open(string $condition = Query\Where::CONDITION_AND) : self
{
if ( null !== ($this->where ?? false) ) {
if ( null !== ($this->where ?? null) ) {
$this->where->conditionList[] = $new = new Query\Where($this, $condition);
$this->where = $new;
}
else {
$this->where = new Query\Where($this, $condition);
$this->push($this->where);
$this->where->conditionList[] = $new = new Query\Where($this, $condition);
$this->where = $new;
}
@@ -149,7 +155,13 @@ class QueryBuilder
public function close() : self
{
if ( null !== ($this->where ?? false) && $this->where->parent ) {
if ( null !== ($this->where ?? null) && $this->where->parent ) {
# if an enclosure was opened, and nothing done, we must remove the unused node
if ( empty($this->where->conditionList) && (count($this->where->parent->conditionList) === 1) ) {
unset($this->where->parent->conditionList);
}
$this->where = $this->where->parent;
}
@@ -167,6 +179,7 @@ class QueryBuilder
}
$this->conditionOperator = $operator;
$where->add($field, $value, $operator, $condition, $not);
return $this;
@@ -179,7 +192,6 @@ class QueryBuilder
public function groupBy() : self
{
//$this->queryBuilder->groupBy();
return $this;
}