Skip to content

Commit

Permalink
Merge pull request #32 from GC-Mark/patch-1
Browse files Browse the repository at this point in the history
Allow `not` expressions
  • Loading branch information
akki-io authored Oct 3, 2023
2 parents 174b793 + 4d7d1a0 commit 5ac667f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Traits/FilterByDimensionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,27 @@ public function whereOrGroupDimensions($dimensions): self
return $this;
}

/**
* Apply whereNot dimension filter.
*
* @return $this
*/
public function whereNotDimension(string $name, int $matchType, $value, bool $caseSensitive = false): self
{
$stringFilter = (new StringFilter())->setCaseSensitive($caseSensitive)
->setMatchType($matchType)
->setValue($value);

$filter = (new Filter())->setStringFilter($stringFilter)
->setFieldName($name);

$this->dimensionFilter = (new FilterExpression())->setNotExpression(
(new FilterExpression())->setFilter($filter)
);

return $this;
}

/**
* Create an array of dimension filters.
*
Expand Down

0 comments on commit 5ac667f

Please sign in to comment.