APIv4 - Deprecate old way of retrieving activityType/optionValue ids
authorColeman Watts <coleman@civicrm.org>
Sat, 2 May 2020 00:30:08 +0000 (20:30 -0400)
committerColeman Watts <coleman@civicrm.org>
Sun, 3 May 2020 13:41:44 +0000 (09:41 -0400)
Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php
Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php
tests/phpunit/api/v4/DataSets/ConformanceTest.json
tests/phpunit/api/v4/DataSets/DefaultDataSet.json
tests/phpunit/api/v4/DataSets/SingleContact.json

index 95f09ac613f7a02d8deb44dc4756e4a267657695..806a3d451ed45876841940b2571f3e9c06815547 100644 (file)
@@ -34,6 +34,7 @@ class ActivityPreCreationSubscriber extends Generic\PreCreationSubscriber {
   protected function modify(DAOCreateAction $request) {
     $activityType = $request->getValue('activity_type');
     if ($activityType) {
+      \CRM_Core_Error::deprecatedFunctionWarning('Use activity_type_id:name instead of activity_type in APIv4');
       $result = OptionValue::get()
         ->setCheckPermissions(FALSE)
         ->addWhere('name', '=', $activityType)
index 83140c7b9afdde5fd939674a296841bf5cd54cc0..355738cf86e9b69d1281fb425451c3aa5397cbbe 100644 (file)
@@ -52,7 +52,7 @@ class OptionValuePreCreationSubscriber extends Generic\PreCreationSubscriber {
     if (!$optionGroupName || $request->getValue('option_group_id')) {
       return;
     }
-
+    \CRM_Core_Error::deprecatedFunctionWarning('Use option_group_id:name instead of option_group in APIv4');
     $optionGroup = OptionGroup::get()
       ->setCheckPermissions(FALSE)
       ->addSelect('id')
index 1028c5b6f80b30c3a6302638272c8e52a46f2a83..15a2a66b1d51fc5d7ad00d6525b9d4ef8ddcbb7c 100644 (file)
@@ -35,7 +35,7 @@
   "Activity": [
     {
       "subject": "Test A Phone Activity",
-      "activity_type": "Phone Call",
+      "activity_type_id:name": "Phone Call",
       "source_contact_id": "@ref test_contact_1.id"
     }
   ]
index 7d4a91bc7797d5d71d59f232c6ed326f0c39d899..834f107460ac1dcfcbc0da922386c84fc777c939 100644 (file)
   "Activity": [
     {
       "subject": "Test Phone Activity",
-      "activity_type": "Phone Call",
+      "activity_type_id:name": "Phone Call",
       "source_contact_id": "@ref test_contact_1.id"
     },
     {
       "subject": "Another Activity",
-      "activity_type": "Meeting",
+      "activity_type_id:name": "Meeting",
       "source_contact_id": "@ref test_contact_1.id",
       "assignee_contact_id": [
         "@ref test_contact_1.id",
index 73e7369e6b9775a7ed237a70a98b5225e698e555..41553368d6d52551aa0f80c41b7710e7d82f4409 100644 (file)
   "Activity": [
     {
       "subject": "Won A Nobel Prize",
-      "activity_type": "Meeting",
+      "activity_type_id:name": "Meeting",
       "source_contact_id": "@ref test_contact_1.id",
       "@ref": "test_activity_1"
     },
     {
       "subject": "Cleaned The House",
-      "activity_type": "Meeting",
+      "activity_type_id:name": "Meeting",
       "source_contact_id": "@ref test_contact_1.id",
       "assignee_contact_id": [
         "@ref test_contact_1.id"