Skip to content

Commit

Permalink
Update QueryObject.php
Browse files Browse the repository at this point in the history
  • Loading branch information
thorewi authored Oct 21, 2023
1 parent 75a4d72 commit 2e0c402
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/QueryObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,12 @@ function($_column) use ($qb, $value, $mode) {

switch ($mode) {
case QueryObjectByMode::STRICT:
$value = $value;
$condition = "$_column = :$paramName";
break;

case QueryObjectByMode::NOT_EQUAL:
$value = $value;
$condition = "$_column != :$paramName";
break;

Expand Down Expand Up @@ -254,18 +256,22 @@ function($_column) use ($qb, $value, $mode) {
break;

case QueryObjectByMode::GREATER:
$value = "$value";
$condition = "$_column > :$paramName";
break;

case QueryObjectByMode::GREATER_OR_EQUAL:
$value = "$value";
$condition = "$_column >= :$paramName";
break;

case QueryObjectByMode::LESS:
$value = "$value";
$condition = "$_column < :$paramName";
break;

case QueryObjectByMode::LESS_OR_EQUAL:
$value = "$value";
$condition = "$_column <= :$paramName";
break;

Expand All @@ -281,10 +287,12 @@ function($_column) use ($qb, $value, $mode) {
if ($mode === QueryObjectByMode::BETWEEN || $mode === QueryObjectByMode::NOT_BETWEEN) {
$qb->setParameter($paramName, $value[0]);
$qb->setParameter($paramName2, $value[1]);
} else if (!is_null($value)) {
} else {
$qb->setParameter($paramName, $value);
}



return $condition;
},
$column
Expand Down

0 comments on commit 2e0c402

Please sign in to comment.