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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
<?php
namespace ICanBoogie\Facets;
use ICanBoogie\ActiveRecord\Query;
trait FetcherTrait
{
protected $criterion_list;
protected function get_criterion_list()
{
return $this->criterion_list;
}
public function alter_criterion_list(CriterionList $criterion_list)
{
return $criterion_list;
}
public function parse_query_string($q)
{
return $this->criterion_list->parse_query_string($q);
}
public function alter_conditions(array &$conditions, array $modifiers)
{
$this->criterion_list->alter_conditions($conditions, $modifiers);
return $conditions;
}
public function alter_query(Query $query)
{
$this->criterion_list->alter_query($query);
return $query;
}
public function alter_query_with_conditions(Query $query, array $conditions)
{
$this->criterion_list->alter_query_with_conditions($query, $conditions);
return $query;
}
public function alter_query_with_order(Query $query, $criterion_id, $order_direction=1)
{
$this->criterion_list->alter_query_with_order($query, $criterion_id, $order_direction);
return $query;
}
public function count_records(Query $query)
{
return $query->count;
}
public function alter_query_with_limit(Query $query, $offset, $limit)
{
return $query->limit($offset, $limit);
}
public function fetch_records(Query $query)
{
return $query->all;
}
public function alter_records(array &$records)
{
$this->criterion_list->alter_records($records);
}
}