--- /dev/null
+<?php
+
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ */
+
+
+namespace Civi\Api4\Service\Spec\Provider;
+
+use Civi\Api4\Service\Spec\RequestSpec;
+
+class BatchCreationSpecProvider implements Generic\SpecProviderInterface {
+
+ /**
+ * @inheritDoc
+ */
+ public function modifySpec(RequestSpec $spec) {
+ $spec->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';
+ }
+
+}
* 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';