QueryCriteria
QueryCriteria
Object describing the filters applied to a Gateway query.
- Full name: \Gibbon\Domain\QueryCriteria
Methods
- fromArray — Loads and sanitizes a set of criteria from array.
- toArray — Return an array representing the criteria settings.
- fromJson — Loads and sanitizes a set of criteria from a JSON string.
- toJson — Returns the criteria settings as a JSON string.
- page — Sets the page number for paginated queries, applied to the sql offset.
- getPage — Gets the page number.
- pageSize — Sets the page size for paginated queries, applied to the sql limit.
- getPageSize — Gets the page size.
- searchBy — Add a search string to the criteria for the specified columns.
- hasSearchColumn — Does the criteria have any search values set, by column or in total?
- hasSearchText — Does the criteria have any search values set, by column or in total?
- getSearchBy — Get all the search values, if any.
- getSearchText — Gets the current search text, optionally including any current filters.
- getSearchColumns — Get the current searched columns.
- filterBy — Add a filter to the criteria.
- hasFilter — Does the criteria have a filter set, by name or in total?
- getFilterBy — Get all the criteria filters, if any.
- getFilterValue — Get a filter value by name, if it exists.
- getFilterString — Returns the current filter array as a string of name:value filters.
- sortBy — Add a sort column to the criteria.
- hasSort — Does the criteria have any sort values set, by column or in total?
- getSortBy — Get the sort value by column name, or return all search columns if none is specified.
- addFilterRule — Add a closure which defines the behaviour for a given filter by name.
- addFilterRules — Add multiple filter rules as an array.
- hasFilterRule — Does the criteria have a filter rule for the given name?
- getFilterRule — Get the filter rule for a given name.
fromArray
Loads and sanitizes a set of criteria from array.
QueryCriteria::fromArray( array $criteria ): self
Returns Self: This method can be chained.
toArray
Return an array representing the criteria settings.
QueryCriteria::toArray( ): array
Return Value:
array
fromJson
Loads and sanitizes a set of criteria from a JSON string.
QueryCriteria::fromJson( string $jsonString ): self
Returns Self: This method can be chained.
toJson
Returns the criteria settings as a JSON string.
QueryCriteria::toJson( ): string
Return Value:
string
page
Sets the page number for paginated queries, applied to the sql offset.
QueryCriteria::page( integer $page ): self
Returns Self: This method can be chained.
getPage
Gets the page number.
QueryCriteria::getPage( ): integer
Return Value:
integer
pageSize
Sets the page size for paginated queries, applied to the sql limit.
QueryCriteria::pageSize( integer $pageSize ): self
Returns Self: This method can be chained.
getPageSize
Gets the page size.
QueryCriteria::getPageSize( ): integer
Return Value:
integer
searchBy
Add a search string to the criteria for the specified columns.
QueryCriteria::searchBy( string|array $column, $text = null ): self
Accepts $column as a string or an array of columns to search. Omitting the $text value will modify the columns for the current search.
Returns Self: This method can be chained.
hasSearchColumn
Does the criteria have any search values set, by column or in total?
QueryCriteria::hasSearchColumn( $column = null ): boolean
Return Value:
boolean
hasSearchText
Does the criteria have any search values set, by column or in total?
QueryCriteria::hasSearchText( ): boolean
Return Value:
boolean
getSearchBy
Get all the search values, if any.
QueryCriteria::getSearchBy( ): string|array
Return Value:
string|array
getSearchText
Gets the current search text, optionally including any current filters.
QueryCriteria::getSearchText( boolean $includeFilters = false ): string
Return Value:
string
getSearchColumns
Get the current searched columns.
QueryCriteria::getSearchColumns( ): array
Return Value:
array
filterBy
Add a filter to the criteria.
QueryCriteria::filterBy( $name, string $value = null ): self
Accepts parameters as filter:value strings, or separate $name, $value params. Values with spaces or other characters can also be quoted, as filter:“some value”
Returns Self: This method can be chained.
hasFilter
Does the criteria have a filter set, by name or in total?
QueryCriteria::hasFilter( $name = null, $value = null ): boolean
Return Value:
boolean
getFilterBy
Get all the criteria filters, if any.
QueryCriteria::getFilterBy( ): array
Return Value:
array
getFilterValue
Get a filter value by name, if it exists.
QueryCriteria::getFilterValue( $name ): array
Return Value:
array
getFilterString
Returns the current filter array as a string of name:value filters.
QueryCriteria::getFilterString( ): string
Return Value:
string
sortBy
Add a sort column to the criteria.
QueryCriteria::sortBy( string $column, string $direction = 'ASC' ): self
Accepts $column as a string or an array of columns to search.
Returns Self: This method can be chained.
hasSort
Does the criteria have any sort values set, by column or in total?
QueryCriteria::hasSort( $column = null ): boolean
Return Value:
boolean
getSortBy
Get the sort value by column name, or return all search columns if none is specified.
QueryCriteria::getSortBy( string $column = null ): string|array
Return Value:
string|array
addFilterRule
Add a closure which defines the behaviour for a given filter by name.
QueryCriteria::addFilterRule( string $name, \Closure $callback ): self
Returns Self: This method can be chained.
addFilterRules
Add multiple filter rules as an array.
QueryCriteria::addFilterRules( array $rules ): self
Returns Self: This method can be chained.
hasFilterRule
Does the criteria have a filter rule for the given name?
QueryCriteria::hasFilterRule( string $name ): boolean
Return Value:
boolean
getFilterRule
Get the filter rule for a given name.
QueryCriteria::getFilterRule( string $name ): \Closure|null
Return Value:
\Closure|null