* @todo a better solutution would be for the query object to apply these filters based on the
* api supported format (but we don't want to risk breakage in alpha stage & query class is scary
* @todo @time of writing only IN & NOT IN are supported for the array style syntax (as test is
- * required to extend further & it may be the comments per above should be implemented
- */
+ * required to extend further & it may be the comments per above should be implemented. It may be
+ * preferable to not double-banger the return context next refactor of this - but keeping the attention
+ * in one place has some advantages as we try to extend this format
+ *
+ * @return NULL|string|array a string is returned if $returnSanitisedArray is not set, otherwise and Array or NULL
+ * depending on whether it is supported as yet
+ **/
public function createSQLFilter($fieldName, $filter, $type, $alias = NULL, $returnSanitisedArray = FALSE) {
// http://issues.civicrm.org/jira/browse/CRM-9150 - stick with 'simple' operators for now
// support for other syntaxes is discussed in ticket but being put off for now
if(!$returnSanitisedArray) {
return (sprintf('%s %s', $fieldName, $operator));
}
+ else{
+ return NULL; // not yet implemented (tests required to implement)
+ }
break;
// ternary operators
if(!$returnSanitisedArray) {
return (sprintf('%s ' . $operator . ' "%s" AND "%s"', $fieldName, CRM_Core_DAO::escapeString($criteria[0]), CRM_Core_DAO::escapeString($criteria[1])));
}
+ else{
+ return NULL; // not yet implemented (tests required to implement)
+ }
break;
// n-ary operators
if(!$returnSanitisedArray) {
return(sprintf('%s %s "%s"', $fieldName, $operator, CRM_Core_DAO::escapeString($criteria)));
}
+ else{
+ return NULL; // not yet implemented (tests required to implement)
+ }
}
}
}