Merge pull request #20951 from eileenmcnaughton/act
[civicrm-core.git] / xml / templates / dao.tpl
index ebfdfb8b5ea5398b2d08abfb0f3e98bd9ff62512..f80ab793ac146b4e56fc2d560af809657613de6a 100644 (file)
@@ -7,7 +7,7 @@
  * {$generated}
  * (GenCodeChecksum:{$genCodeChecksum})
  */
-{$useHelper}
+{if isset($useHelper)}{$useHelper}{/if}
 /**
  * Database access object for the {$table.entity} entity.
  */
@@ -24,6 +24,16 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
       */
       public static $_tableName = '{$table.name}';
 
+   {* Only print this variable if it's different than the default in CRM_Core_DAO *}
+   {if count($table.primaryKey.field) !== 1 || $table.primaryKey.field.0 !== 'id'}
+     /**
+      * Primary key field(s).
+      *
+      * @var string[]
+      */
+      public static $_primaryKey = [{if $table.primaryKey.field}'{"', '"|implode:$table.primaryKey.field}'{/if}];
+   {/if}
+
    {if $table.icon}
      /**
       * Icon associated with this entity.