1 | <?php |
||
22 | class QuantityHandler extends DataValueHandler { |
||
23 | |||
24 | /** |
||
25 | * @see DataValueHandler::getBaseTableName |
||
26 | */ |
||
27 | protected function getBaseTableName() { |
||
30 | |||
31 | /** |
||
32 | * @see DataValueHandler::completeTable |
||
33 | */ |
||
34 | protected function completeTable( Table $table ) { |
||
47 | |||
48 | /** |
||
49 | * @see DataValueHandler::getInsertValues |
||
50 | * |
||
51 | * @param DataValue $value |
||
52 | * |
||
53 | * @throws InvalidArgumentException |
||
54 | * @return array |
||
55 | */ |
||
56 | public function getInsertValues( DataValue $value ) { |
||
74 | |||
75 | /** |
||
76 | * @see DataValueHandler::addMatchConditions |
||
77 | * |
||
78 | * @param QueryBuilder $builder |
||
79 | * @param ValueDescription $description |
||
80 | * |
||
81 | * @throws InvalidArgumentException |
||
82 | * @throws QueryNotSupportedException |
||
83 | */ |
||
84 | public function addMatchConditions( QueryBuilder $builder, ValueDescription $description ) { |
||
99 | |||
100 | /** |
||
101 | * @param QueryBuilder $builder |
||
102 | * @param QuantityValue $value |
||
103 | */ |
||
104 | private function addByQuantityConditions( QueryBuilder $builder, QuantityValue $value ) { |
||
112 | |||
113 | /** |
||
114 | * @param QueryBuilder $builder |
||
115 | * @param DecimalValue $value |
||
116 | */ |
||
117 | private function addSameValueConditions( QueryBuilder $builder, DecimalValue $value ) { |
||
122 | |||
123 | /** |
||
124 | * We are not asking if the given search value fits in a range, we are searching for |
||
125 | * values within the given search range. |
||
126 | * |
||
127 | * If searching for 1500 m (with default precision +/-1) we don't want to find 1501 m, |
||
128 | * but want to find 1500.99 m (no matter what the precision is). |
||
129 | * So the range is ]-precision,+precision[ (exclusive). |
||
130 | * |
||
131 | * @param QueryBuilder $builder |
||
132 | * @param QuantityValue $value |
||
133 | */ |
||
134 | private function addInRangeConditions( QueryBuilder $builder, QuantityValue $value ) { |
||
141 | |||
142 | /** |
||
143 | * @param string $unit |
||
144 | * |
||
145 | * @return string|null |
||
146 | */ |
||
147 | private function normalizeUnit( $unit ) { |
||
150 | |||
151 | } |
||
152 |