ICanBoogie/Facets 0.4.x
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • Facets
      • RecordCollection

Classes

  • BooleanCriterion
  • Criterion
  • CriterionList
  • CriterionNotDefined
  • CriterionValue
  • Fetcher
  • IntervalCriterionValue
  • QueryString
  • QueryStringWord
  • RecordCollection
  • SetCriterionValue

Interfaces

  • CriterionInterface
  • FetcherInterface

Traits

  • CriterionTrait
  • FetcherTrait
  • HumanizePairsTrait
  • ModelBindings
  • ParseQueryStringTrait

Trait CriterionTrait

Trait for a generic criterion.

Direct Known Users

ICanBoogie\Facets\Criterion

Indirect Known Users

ICanBoogie\Facets\BooleanCriterion

Namespace: ICanBoogie\Facets
Located at CriterionTrait.php

Methods summary

protected
# get_id( )

Returns the criterion's identifier.

Returns the criterion's identifier.

protected
# get_column_name( )

Returns the criterion's column name, or if it is empty the criterion's identifier.

Returns the criterion's column name, or if it is empty the criterion's identifier.

public ICanBoogie\Facets\QueryString
# parse_query_string( ICanBoogie\Facets\QueryString $q )

Parses the query string and marks words matched by the criterion.

Parses the query string and marks words matched by the criterion.

Parameters

$q

Returns

ICanBoogie\Facets\QueryString
public mixed
# parse_value( mixed $value )

Parses the criterion value using CriterionValue::from().

Parses the criterion value using CriterionValue::from().

Parameters

$value

Returns

mixed
public
# alter_conditions( array & $conditions, array $modifiers )

Unset the condition if the modifier is null or an empty string.

Unset the condition if the modifier is null or an empty string.

Parameters

$conditions
$modifiers
public
# alter_query( ICanBoogie\ActiveRecord\Query $query )
public ICanBoogie\ActiveRecord\Query
# alter_query_with_value( ICanBoogie\ActiveRecord\Query $query, mixed $value )

Alters the query according to the specified value.

Alters the query according to the specified value.

The method handles ICanBoogie\Facets\IntervalCriterionValue and ICanBoogie\Facets\SetCriterionValue instances as well as plain values, for which a simple {$this->id} = {$value} is done.

Subclasses might want to override the method according to the kind of value they provide.

Parameters

$query
$value

The criterion value. Special care is taken if the param is an instance of ICanBoogie\Facets\IntervalCriterionValue or ICanBoogie\Facets\SetCriterionValue.

Returns

ICanBoogie\ActiveRecord\Query
public ICanBoogie\ActiveRecord\Query
# alter_query_with_order( ICanBoogie\ActiveRecord\Query $query, integer $order_direction )

Alters the query with an order.

Alters the query with an order.

The ICanBoogie\Facets\CriterionTrait::$column_name property is used.

Parameters

$query
$order_direction
"DESC" if inferior to 0, "ASC" otherwise.

Returns

ICanBoogie\ActiveRecord\Query
public
# alter_records( array & $records )
public string|ICanBoogie\Facets\IntervalCriterionValue
# humanize( mixed $value )

Returns a human readable value.

Returns a human readable value.

Parameters

$value

Returns

string|ICanBoogie\Facets\IntervalCriterionValue
public string
# format_humanized_value( mixed $humanized_value )

Formats a humanized value, or array of values, into a string.

Formats a humanized value, or array of values, into a string.

Parameters

$humanized_value

Returns

string

Properties summary

protected string $id

The identifier of the criterion.

The identifier of the criterion.

#
protected string $column_name

The column name of the criterion, as in a SQL table.

The column name of the criterion, as in a SQL table.

#
ICanBoogie/Facets 0.4.x API documentation generated by ApiGen