Data modeling - sgml/signature GitHub Wiki

Mapping CRM to RDBMS

Platform Parent Object Child Object Grandchild Object Stored Value Relationship Implementation Custom Object Limitations
Salesforce Foo__c Bar__c Baz__c "bop" Lookup fields: Bar__c → Foo__c, Baz__c → Bar__c Limited to 2,000 custom objects per org; lookups can become complex; querying nested hierarchies requires SOQL joins and may hit governor limits
HubSpot Foo (Custom Object) Bar (Custom Object) Baz (Custom Object) "bop" Association API: Bar associated to Foo, Baz associated to Bar Only 10 custom objects per account; associations are flexible but not deeply relational; reporting across multiple levels is limited
CiviCRM Table: foo Table: bar Table: baz "bop" Foreign keys: bar.foo_id → foo.id, baz.bar_id → bar.id No hard cap on tables, but schema changes require database admin; custom groups/fields can become unwieldy; querying serialized data is inefficient
Postgres Table: foo Table: bar Table: baz "bop" Foreign keys: bar.foo_id → foo.id, baz.bar_id → bar.id OR native JSONB column with nested structure No practical limit on tables; JSONB allows direct nested storage and indexing; complexity arises in designing hybrid relational + JSONB queries

Modeling CRM Mappings to MVC

+=========================================================================+
|                          M O D E L   L A Y E R                          |
+=========================================================================+

                    SUITECRM                               CIVICRM
                    --------                               --------

   +-----------------------------+        +--------------------------------+
   |  M: Model Override Points   |        |   M: Model Override Points     |
   +-----------------------------+        +--------------------------------+
   |  SugarBean.php        [C]   |        |  DAO/<Entity>.php        [M]   |
   |  BeanFactory.php      [C]   |        |  BAO/<Entity>.php        [M]   |
   |  VardefManager.php    [C]   |        |  APIv4/<Entity>/Create   [M]   |
   |  <Module>Bean.php     [C]   |        |  APIv4/<Entity>/Update   [M]   |
   |  vardefs.php          [A]   |        |  APIv4/<Entity>/Delete   [M]   |
   |  relationship defs     [A]  |        |  Field validators        [F]   |
   +-----------------------------+        +--------------------------------+

   NOTES:
   SuiteCRM model patches = class-level.
   CiviCRM model patches = method-level + field-level.


+=========================================================================+
|                          V I E W   L A Y E R                            |
+=========================================================================+

                    SUITECRM                               CIVICRM
                    --------                               --------

   +-----------------------------+        +--------------------------------+
   |  V: View Override Points    |        |   V: View Override Points      |
   +-----------------------------+        +--------------------------------+
   |  View.php              [C]  |        |  CRM/*/Form/*.php        [M]   |
   |  Smarty templates      [T]  |        |  buildForm()             [M]   |
   |  tpl overrides         [T]  |        |  addField()              [F]   |
   |  metadata layouts      [A]  |        |  setDefault()            [F]   |
   |  no field isolation    (!)  |        |  per-element callbacks   [F]   |
   +-----------------------------+        +--------------------------------+

   NOTES:
   SuiteCRM view patches = template-level.
   CiviCRM view patches = element-level.


+=========================================================================+
|                     C O N T R O L L E R   /   A P I                     |
+=========================================================================+

                    SUITECRM                               CIVICRM
                    --------                               --------

   +-----------------------------+        +--------------------------------+
   |  C: Controller/API Points   |        |   C: Controller/API Points     |
   +-----------------------------+        +--------------------------------+
   |  Controller.php        [C]  |        |  APIv4/<Entity>/Actions   [M]  |
   |  EntryPointRegistry    [C]  |        |  pre() / post() hooks     [H]  |
   |  REST v4_1 endpoints   [A]  |        |  apiWrappers()            [H]  |
   |  REST v10 endpoints    [A]  |        |  per-action override      [M]  |
   |  SOAP endpoints        [A]  |        |  per-entity override      [M]  |
   |  logic_hooks.php       [H]  |        |  per-field override       [F]  |
   +-----------------------------+        +--------------------------------+

   NOTES:
   SuiteCRM controller patches = endpoint-level.
   CiviCRM controller patches = action-level.


+=========================================================================+
|                         G R A N U L A R I T Y                           |
+=========================================================================+

   SUITECRM:   smallest natural override = CLASS or TEMPLATE
   CiviCRM:    smallest natural override = METHOD or FIELD

+=========================================================================+

Models

Type Systems

Doubly Linked List

Linked List

Hashtable

Map / Hashmap

B Tree

Lazy List

⚠️ **GitHub.com Fallback** ⚠️