APIv4 - Add SortableEntity type which auto-adjusts weights
authorColeman Watts <coleman@civicrm.org>
Fri, 26 Nov 2021 00:28:56 +0000 (19:28 -0500)
committerColeman Watts <coleman@civicrm.org>
Mon, 29 Nov 2021 13:46:02 +0000 (08:46 -0500)
commit076fe09aa31cb92fa9e254b06a32e17ce5c76e4b
tree7b8b738371b312f608fb4e680b47c5fa41a7ef65
parent2031271ca6688a49ec12c3d7b0db0fb264665f23
APIv4 - Add SortableEntity type which auto-adjusts weights

This entity type will manage weight columns automatically, allowing items to be
re-ordered easily.
Simply by updating the weight of one record, others will auto-adjust to make room for it.
18 files changed:
CRM/Utils/String.php
CRM/Utils/Weight.php
Civi/Api4/Contact.php
Civi/Api4/CustomField.php
Civi/Api4/CustomGroup.php
Civi/Api4/Entity.php
Civi/Api4/Generic/AbstractEntity.php
Civi/Api4/Generic/Traits/DAOActionTrait.php
Civi/Api4/Generic/Traits/SortableEntity.php [new file with mode: 0644]
Civi/Api4/MembershipStatus.php
Civi/Api4/MembershipType.php
Civi/Api4/OptionValue.php
Civi/Api4/PriceField.php
Civi/Api4/PriceFieldValue.php
Civi/Api4/UFField.php
tests/phpunit/api/v4/Action/BasicCustomFieldTest.php
tests/phpunit/api/v4/Entity/MembershipTest.php [new file with mode: 0644]
tests/phpunit/api/v4/Entity/OptionValueTest.php