Class FilterBuilder
A set of static methods for building a filter.
The FilterBuilder class is a utility that is intended to be used to create filters for eSales queries.
The methods in this class are all static and return some kind of Apptus\ESales\Connector\Filter
limiting your search.
Example:
// Create some simple attribute filters $a = FilterBuilder::attribute('artist', 'Presley'); $b = FilterBuilder::attribute('song', 'Jumpin\' Jack Flash'); $c = FilterBuilder::attribute('description', 'Rock nostalgia'); echo 'Created some attribute filters:' . PHP_EOL; echo $a . PHP_EOL; echo $b . PHP_EOL; echo $c . PHP_EOL; echo PHP_EOL; // Let's combine them $kingOfRock = FilterBuilder::andFilter($a, $c); echo $kingOfRock . PHP_EOL; $classic = FilterBuilder::andFilter(b, c); echo $classic . PHP_EOL; $justCool = FilterBuilder::orFilter(a, b); echo $justCool . PHP_EOL; $coolOldie = FilterBuilder::andFilter(justCool, c); echo $coolOldie . PHP_EOL; echo PHP_EOL; // Let's add some more stuff into the mix $lamers = FilterBuilder::attributeFilter('artist', 'Sofarock'); $lamers = FilterBuilder::orFilter($lamers, FilterBuilder::attributeFilter('artist', 'amazonics')); $noLamers = FilterBuilder::notFilter($lamers); echo $noLamers . PHP_EOL; // Combine more than 2 filters at once by simply supplying them all $theOriginal = FilterBuilder::andFilter($classic, $noLamers, $c); echo $theOriginal . PHP_EOL;
public static
|
#
notFilter(
Create a new NOT filter matching every result that the given operand doesn't match. |
public static
|
|
public static
|
|
public static
|
#
attributeFilter( string|array $attributes, string $value )
Create a new attribute filter, limiting results to products where all processed parts (after tokenization and normalization) of the specified $value
are present within any of the given $attributes
. |
public static
|
#
fromString( string $filter, boolean $needsParentheses = true )
Create a new filter from a string representation of a filter. |
public static
|
#
incrementalFilter( string|array $attributes, string $value )
Create a new INCREMENTAL filter, limiting the result to products where all processed parts (after tokenization and normalization) of the specified $value
are present within any of the given $attributes
. The last value token matches if any attribute contains a value to which it is a prefix (after tokenization). |
public static
|
#
rangeFilter( string|array $attributes, string $from, string $to, boolean $fromInc = true, boolean $toInc = false )
Create a new range filter limiting results to values between $from
and $to
, for any of the specified $attributes
. Whether or not the bounds should be considered inclusive or exclusive is determined by the specified $fromInc
and $toInc
parameters. |
public static
|
|
public static
|