In my extension (it's the first one I'm writing) I have the need to create a new DB table and to manage it (insert, update, delete records). How can I do it? Thanks Marcello


Check this section on the wiki: https://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Module+Extension#CreateaModuleExtension-Addadatabaseupgrader/Installer/uninstaller You will need to add an upgrader to your extension, and from that upgrader you can manage your database file installs. Also, you might want to add a DAO class?

| improve this answer | |
  • Thank's ErickH, I had already read that section and I'm able to create/destroy my table on the DB and I made some web forms. My problem Is now how to create: 1) a table element list page with buttons Add, Modify ... 2) an edit form. There are some examples or maybe a some code page I can use to start? – marcello Apr 21 '16 at 16:52
  • Can I avoid to create a DAO class? – marcello Apr 21 '16 at 16:54
  • You certainly can, but it might make life easier if you do. It depends on what you want to do with your table. If I want to use it in a form and page etc. having a DAO actually helps me. – ErikH - CiviCooP Apr 23 '16 at 13:23

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