Merge pull request #20951 from eileenmcnaughton/act
[civicrm-core.git] / xml / templates / dao.tpl
index 7aacd67d3aa851fec4aa643cfcab7ca8ba68ff5a..f80ab793ac146b4e56fc2d560af809657613de6a 100644 (file)
@@ -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.