Api4 - Use explicit adder functions rather than magicMethod
authorColeman Watts <coleman@civicrm.org>
Fri, 24 Jan 2020 14:16:08 +0000 (09:16 -0500)
committerColeman Watts <coleman@civicrm.org>
Fri, 24 Jan 2020 14:27:29 +0000 (09:27 -0500)
commit121ec912ba6c0e30cbab311024396e09a87211e3
tree0726260ae23b00b0a90d1637bd05e5f2b1ebd398
parentdf2c2828cf43649cf729c221e847bd4f26130a82
Api4 - Use explicit adder functions rather than magicMethod

Api Actions had been relying on a magic method to provide getter/setter functions for params.
That works fine for simple get/set operations but it was also attempting to provide adder functions.
Those are more nuanced and the magic method didn't do a good job of understanding whether the param
was an indexed or unindexed array, and didn't do strict type checking.
Making our own adder functions gives better documentation, stricter checking of inputs and also
the convenience of variadic functions for adding several values at once.
13 files changed:
Civi/API/Kernel.php
Civi/Api4/Action/Setting/Get.php
Civi/Api4/Action/Setting/Revert.php
Civi/Api4/Action/Setting/Set.php
Civi/Api4/Generic/AbstractAction.php
Civi/Api4/Generic/AbstractCreateAction.php
Civi/Api4/Generic/AbstractGetAction.php
Civi/Api4/Generic/AbstractQueryAction.php
Civi/Api4/Generic/AbstractSaveAction.php
Civi/Api4/Generic/AbstractUpdateAction.php
Civi/Api4/Generic/BasicGetFieldsAction.php
Civi/Api4/Generic/BasicReplaceAction.php
Civi/Api4/Generic/DAOEntity.php