ICanBoogie
  • Documentation
  • API Reference
  • Facets v0.3.1
Namespaces
  • ICanBoogie
    • Facets
      • RecordCollection
Classes
  • BooleanCriterion
  • Criterion
  • CriterionList
  • CriterionNotDefined
  • CriterionValue
  • Fetcher
  • IntervalCriterionValue
  • QueryString
  • QueryStringWord
  • RecordCollection
  • SetCriterionValue
Interfaces
  • CriterionInterface
  • FetcherInterface
Traits
  • CriterionTrait
  • FetcherTrait
  • HumanizePairsTrait
  • 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( void )

Returns the criterion's identifier.

Returns the criterion's identifier.

protected get_column_name( void )

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 parse_query_string( ICanBoogie\Facets\QueryString $q ) : ICanBoogie\Facets\QueryString

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 parse_value( mixed $value ) : mixed

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 alter_query_with_value( ICanBoogie\ActiveRecord\Query $query, mixed $value ) : ICanBoogie\ActiveRecord\Query

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 alter_query_with_order( ICanBoogie\ActiveRecord\Query $query, integer $order_direction ) : ICanBoogie\ActiveRecord\Query

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 humanize( mixed $value ) : string|ICanBoogie\Facets\IntervalCriterionValue

Returns a human readable value.

Returns a human readable value.

Parameters

$value

Returns

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

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 $id : string

The identifier of the criterion.

The identifier of the criterion.


		
protected $column_name : string

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

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


		
Facets v0.3.1 – Check on GitHub – API documentation generated by ApiGen