APIv4 - add is_current as a pseudo (calculated) field
authorColeman Watts <coleman@civicrm.org>
Sun, 13 Jun 2021 01:36:39 +0000 (21:36 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 1 Jul 2021 23:40:54 +0000 (19:40 -0400)
commit9c961a3ae053ab117b0a07d6a7417a16502946a5
tree80be8909ee64e3c4d7968f0c648174aeff18b638
parent14ac1ccd0e8269252f46cf16470d1054caa43a6d
APIv4 - add is_current as a pseudo (calculated) field

This adds the first calculated field to APIv4. It works by injecting a SQL function and aliasing it
with the name of the fake field. This approach allows it to work as part of the WHERE clause
as well as the SELECT clause, even across joins.

Marking the old "is_current" api param deprecated because the field works better.
15 files changed:
Civi/Api4/Action/Campaign/Get.php
Civi/Api4/Action/Event/Get.php
Civi/Api4/Action/Relationship/Get.php
Civi/Api4/Event/Subscriber/IsCurrentSubscriber.php
Civi/Api4/Generic/DAOGetFieldsAction.php
Civi/Api4/Generic/Traits/IsCurrentTrait.php
Civi/Api4/Query/Api4SelectQuery.php
Civi/Api4/Query/SqlField.php
Civi/Api4/Service/Schema/Joinable/Joinable.php
Civi/Api4/Service/Spec/FieldSpec.php
Civi/Api4/Service/Spec/Provider/IsCurrentFieldSpecProvider.php [new file with mode: 0644]
Civi/Api4/Service/Spec/RequestSpec.php
Civi/Api4/Service/Spec/SpecGatherer.php
Civi/Test/Api3TestTrait.php
tests/phpunit/api/v4/Action/CurrentFilterTest.php