ICanBoogie
  • Documentation
  • API Reference
  • Facets 0.6.x
Namespaces
  • ICanBoogie
    • Facets
      • Criterion
      • CriterionValue
      • Fetcher
      • RecordCollection
Classes
  • CriterionList
  • CriterionNotDefined
  • CriterionValue
  • QueryString
  • QueryStringWord
  • RecordCollection
Interfaces
  • Criterion
  • Fetcher
Traits
  • CriterionTrait
  • FetcherTrait
  • ModelBindings

Trait CriterionTrait

Trait for a generic criterion.

Direct Known Users

ICanBoogie\Facets\Criterion\BasicCriterion

Indirect Known Users

ICanBoogie\Facets\Criterion\BooleanCriterion, ICanBoogie\Facets\Criterion\DateCriterion

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\CriterionValue\IntervalCriterionValue and ICanBoogie\Facets\CriterionValue\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\CriterionValue\IntervalCriterionValue or ICanBoogie\Facets\CriterionValue\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\CriterionValue\IntervalCriterionValue

Returns a human readable value.

Returns a human readable value.

Parameters

$value

Returns

string|ICanBoogie\Facets\CriterionValue\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 0.6.x – Check on GitHub – API documentation generated by ApiGen