User Tools

Site Tools


filter_class

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
filter_class [2019/10/17 19:57] – created sahlfilter_class [2020/08/07 11:35] (current) sahl
Line 12: Line 12:
  
 <code php> <code php>
-$filter->addCondition(new FilterConditionMatch('lastname', 'sahl'));+$filter->addCondition(new ConditionMatch('lastname', 'sahl'));
 </code> </code>
  
-And at last the filter is executed which will return a [[datacollection_class|Datacollection]] 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, $condition2);+new ConditionAND($condition1, $condition2);
 // 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, $filter); 
 +// 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, $condition2);+new ConditionOR($condition1, $condition2);
 // 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.
 </code> </code>
  
 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->toJSON();
 +</code>
 +
 +And they can be reconstructed just as easy.
 +
 +<code php>
 +$filter = Filter::getFilterFromJSON($json);
 +</code>
 +
filter_class.1571342225.txt.gz · Last modified: 2019/10/17 19:57 by sahl

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki