if (empty($dataType)) {
$dataType = 'String';
}
-
+ if (is_array($value)) {
+ //this could have come from the api - as in the restWhere section we potentially use the api operator syntax which is becoming more
+ // widely used and consistent across the codebase
+ // adding this here won't accept the search functions which don't submit an array
+ if (($queryString = CRM_Core_DAO::createSqlFilter($field, $value, $dataType)) != FALSE) {
+ return $queryString;
+ }
+ }
$value = CRM_Utils_Type::escape($value, $dataType);
// if we don't have a dataType we should assume
if ($dataType == 'String' || $dataType == 'Text') {
$domainBAO = CRM_Core_Config::domainID();
$params['id'] = $domainBAO;
}
+ if (!empty($params['options']) && !empty($params['options']['is_count'])) {
+ return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+ }
_civicrm_api3_dao_set_filter($bao, $params, true, 'domain');
$domains = _civicrm_api3_dao_to_array($bao, $params, true,'domain');
*/
function _civicrm_api3_dao_set_filter(&$dao, $params, $unique = TRUE, $entity) {
$entity = substr($dao->__table, 8);
-
- $allfields = _civicrm_api3_build_fields_array($dao, $unique);
-
- $fields = array_intersect(array_keys($allfields), array_keys($params));
- if (isset($params[$entity . "_id"])) {
+ if (!empty($params[$entity . "_id"]) && empty($params['id'])) {
//if entity_id is set then treat it as ID (will be overridden by id if set)
- $dao->id = $params[$entity . "_id"];
+ $params['id'] = $params[$entity . "_id"];
}
+ $allfields = _civicrm_api3_build_fields_array($dao, $unique);
+ $fields = array_intersect(array_keys($allfields), array_keys($params));
$options = _civicrm_api3_get_options_from_params($params);
//apply options like sort