Database standards¶
The following standards apply to the database layer in CiviCRM:
- Every BAO will have a create function. This will be called by the API & form layer.
- The create function will take a single params array.
- Depending on the parameters passed in, the create function will perform any additional actions like creating activities.
- The create function will call hooks.
- We are moving away from the
$ids
array being included. - The add function (if it exists) will be internal to the BAO layer.
- If any additional actions are to be done when deleting the BAO there should be a function
del
which takes the entity id as the only required parameter. - The delete action will take any additional tasks like deleting additional objects (generally done by code).
- The delete action will take an array including
['id']
. - The api will call the
del
action & fall back onto delete. It is recommended that the form layer call the API.