filter_class
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| filter_class [2019/10/17 19:57] – [Filter class] sahl | filter_class [2020/08/07 11:35] (current) – sahl | ||
|---|---|---|---|
| Line 12: | Line 12: | ||
| <code php> | <code php> | ||
| - | $filter-> | + | $filter-> |
| </ | </ | ||
| - | And at last the filter is executed which will return a [[datarecordcollection_class|DataRecordCollection]] with the results. | + | And at last the filter is executed which will return a [[collection_class|Collection]] with the results. |
| <code php> | <code php> | ||
| Line 26: | Line 26: | ||
| <code php> | <code php> | ||
| - | new FilterConditionAND($condition1, | + | new ConditionAND($condition1, |
| // Return objects for which both conditions are true. | // Return objects for which both conditions are true. | ||
| - | new FilterConditionGreater($field, $value); | + | new ConditionGreater($field, $value); |
| // Return objects where the content of $field are greater than $value. | // Return objects where the content of $field are greater than $value. | ||
| - | new FilterConditionGreaterEqual($field, $value); | + | new ConditionGreaterEqual($field, $value); |
| // Return objects where the content of $field are greater or equal than $value. | // Return objects where the content of $field are greater or equal than $value. | ||
| - | new FilterConditionLesser($field, $value); | + | new ConditionInFilter($field, |
| + | // Return objects where the content of $field are present in the filter $filter. | ||
| + | |||
| + | new ConditionLesser($field, $value); | ||
| // Return objects where the content of $field are lesser than $value. | // Return objects where the content of $field are lesser than $value. | ||
| - | new FilterConditionLesserEqual($field, $value); | + | new ConditionLesserEqual($field, $value); |
| // Return objects where the content of $field are lesser or equal than $value. | // Return objects where the content of $field are lesser or equal than $value. | ||
| - | new FilterConditionLike($field, $value); | + | new ConditionLike($field, $value); |
| // Return objects where the content of $field contains part of $value. | // Return objects where the content of $field contains part of $value. | ||
| - | new FilterConditionMatch($field, $value); | + | new ConditionMatch($field, $value); |
| // Return objects where the content of $field is exactly $value. | // Return objects where the content of $field is exactly $value. | ||
| - | new FilterConditionNOT($condition); | + | new ConditionNOT($condition); |
| // Return all objects which isn't matched by $condition. | // Return all objects which isn't matched by $condition. | ||
| - | new FilterConditionOR($condition1, | + | new ConditionOR($condition1, |
| // Return objects where one of the conditions is true. | // Return objects where one of the conditions is true. | ||
| - | new FilterConditionOneOf($field, $values); | + | new ConditionOneOf($field, $values); |
| // Return objects where the content of $field is one of the supplied $values. | // Return objects where the content of $field is one of the supplied $values. | ||
| </ | </ | ||
| Not all conditions work on all field types. | Not all conditions work on all field types. | ||
| + | |||
| + | ===== Serializing filters ===== | ||
| + | |||
| + | Filters can be serialized as a JSON string, so they can be stored in databases or passed through forms. | ||
| + | |||
| + | <code php> | ||
| + | $json = $filter-> | ||
| + | </ | ||
| + | |||
| + | And they can be reconstructed just as easy. | ||
| + | |||
| + | <code php> | ||
| + | $filter = Filter:: | ||
| + | </ | ||
| + | |||
filter_class.1571342261.txt.gz · Last modified: 2019/10/17 19:57 by sahl