1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
<?php
/*
* This file is part of the ICanBoogie package.
*
* (c) Olivier Laviale <olivier.laviale@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ICanBoogie\Facets;
use ICanBoogie\ActiveRecord\Query;
/**
* An interface common to Criteria.
*/
interface CriterionInterface
{
/**
* Parses the query string and marks words matched by the criterion.
*
* @param QueryString $q
*
* @return QueryString
*/
public function parse_query_string(QueryString $q);
/**
* Parses a criterion value.
*
* @param mixed $value
*/
public function parse_value($value);
/**
* Alters the conditions according to the specified modifiers.
*
* @param array $conditions The conditions to alter.
* @param array $modifiers The modifiers.
*/
public function alter_conditions(array &$conditions, array $modifiers);
/**
* Alters the initial query.
*
* @param Query $query
*
* @return Query $query The altered query.
*/
public function alter_query(Query $query);
/**
* Alters the query according to the value specified.
*
* **Note:** The method is only invoked if a value key matches the criterion identifier.
*
* @param Query $query
* @param mixed $value
*
* @return Query
*/
public function alter_query_with_value(Query $query, $value);
/**
* Alters the ORDER clause of the query according to the column identifier and the order
* direction.
*
* **Note:** The method is only invoked if the ordering column matches the criterion identifier.
*
* @param Query $query
* @param int $order_direction
*
* @return Query
*/
public function alter_query_with_order(Query $query, $order_direction);
/**
* Alters the records.
*
* @param \ICanBoogie\ActiveRecord[] $records
*
* @return \ICanBoogie\ActiveRecord[]
*/
public function alter_records(array &$records);
}