APIv4 - Refactor writeObjects to choose BAO function based on annotations
authorColeman Watts <coleman@civicrm.org>
Thu, 6 Jan 2022 22:46:10 +0000 (17:46 -0500)
committerColeman Watts <coleman@civicrm.org>
Mon, 10 Jan 2022 21:18:03 +0000 (16:18 -0500)
commit5a443458b6e14de9c21ded8cc3f1976228a47524
tree3e7c0160a3f57bf546573ae7aa8d36137adb3afd
parentb34edcf6b596214dfc2860777417d52b185343dc
APIv4 - Refactor writeObjects to choose BAO function based on annotations

Instead of using a hardcoded list of BAO functions to call, with extra
hardcoded params to e.g. the Contact & Address BAOs, this switches
to picking the BAO's create/add only if it's not `@deprecated`,
and falling back to WriteRecords.

Also refactors the large `writeObjects` function into two smaller
functions so individual action classes can more easily override them.
13 files changed:
Civi/Api4/Action/Address/AddressSaveTrait.php
Civi/Api4/Action/CiviCase/CiviCaseSaveTrait.php
Civi/Api4/Action/Contact/Save.php [new file with mode: 0644]
Civi/Api4/Action/Contact/Update.php [new file with mode: 0644]
Civi/Api4/Action/EntityTag/Create.php [new file with mode: 0644]
Civi/Api4/Action/EntityTag/EntityTagSaveTrait.php [new file with mode: 0644]
Civi/Api4/Action/EntityTag/Save.php [new file with mode: 0644]
Civi/Api4/Action/EntityTag/Update.php [new file with mode: 0644]
Civi/Api4/Action/GroupContact/GroupContactSaveTrait.php
Civi/Api4/Contact.php
Civi/Api4/EntityTag.php
Civi/Api4/Generic/Traits/CustomValueActionTrait.php
Civi/Api4/Generic/Traits/DAOActionTrait.php