Пример #1
0
 /**
  * @param string $bao_name
  *   Name of BAO
  * @param array $params
  *   As passed into api get function.
  * @param bool $isFillUniqueFields
  *   Do we need to ensure unique fields continue to be populated for this api? (backward compatibility).
  */
 public function __construct($bao_name, $params, $isFillUniqueFields)
 {
     $this->bao = new $bao_name();
     $this->entity = _civicrm_api_get_entity_name_from_dao($this->bao);
     $this->params = $params;
     $this->isFillUniqueFields = $isFillUniqueFields;
     $this->checkPermissions = \CRM_Utils_Array::value('check_permissions', $this->params, FALSE);
     $this->options = _civicrm_api3_get_options_from_params($this->params);
     $this->entityFieldNames = _civicrm_api3_field_names(_civicrm_api3_build_fields_array($this->bao));
     // Call this function directly instead of using the api wrapper to force unique field names off
     require_once 'api/v3/Generic.php';
     $apiSpec = \civicrm_api3_generic_getfields(array('entity' => $this->entity, 'version' => 3, 'params' => array('action' => 'get')), FALSE);
     $this->apiFieldSpec = $apiSpec['values'];
     $this->query = \CRM_Utils_SQL_Select::from($this->bao->tableName() . " a");
 }