I am looking for a best practice approach. I am working on a module extension, which involves creation, retrieval and deletion of an entity(object).

I have created the DAO files for them, I am looking to the write place to write insertion and selection queries. Currently I am confused about writing them in a BAO file or the API functions.

Is writing this code directly in API functions a bad approach, and having a BAO is a necessity. Also, if we create a BAO is there a guide I should follow about what to do and what not to do.

1 Answer 1


The BAO is not required, but it is what we always used to do. So the standard approach is: the API uses the BAO/DAO functions to insert and select. You can find a pretty simple example here: https://github.com/CiviCooP/no.maf.oppgavexml/tree/master/CRM/Oppgavexml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.