From: Monish Deb Date: Fri, 4 Jun 2021 07:12:08 +0000 (+0530) Subject: Add APIv4 Batch.create spec X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4c35651e77f27cdf9f99dfd1174ff6db6aed9cb4;p=civicrm-core.git Add APIv4 Batch.create spec --- diff --git a/Civi/Api4/Service/Spec/Provider/BatchCreationSpecProvider.php b/Civi/Api4/Service/Spec/Provider/BatchCreationSpecProvider.php new file mode 100644 index 0000000000..d45ae81e50 --- /dev/null +++ b/Civi/Api4/Service/Spec/Provider/BatchCreationSpecProvider.php @@ -0,0 +1,43 @@ +getFieldByName('created_id')->setDefaultValue('user_contact_id'); + $spec->getFieldByName('created_date')->setDefaultValue('now'); + $spec->getFieldByName('modified_id')->setDefaultValue('user_contact_id'); + $spec->getFieldByName('modified_date')->setDefaultValue('now'); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'Batch' && $action === 'create'; + } + +} diff --git a/api/v3/Batch.php b/api/v3/Batch.php index 8eedd82429..0b68afe415 100644 --- a/api/v3/Batch.php +++ b/api/v3/Batch.php @@ -37,11 +37,6 @@ function civicrm_api3_batch_create($params) { * Array of parameters determined by getfields. */ function _civicrm_api3_batch_create_spec(&$params) { - //@todo - the entity table field looks like it is not actually required & should probably be removed (or a description added if - // it is actually required) - $params['entity_table']['api.default'] = "civicrm_batch"; - $params['entity_table']['type'] = CRM_Utils_Type::T_STRING; - $params['entity_table']['title'] = 'Batch Entity Table - remove?'; $params['created_id']['api.default'] = 'user_contact_id'; $params['created_date']['api.default'] = 'now'; $params['modified_id']['api.default'] = 'user_contact_id';