Merge pull request #10660 from seamuslee001/CRM-20860-processor
[civicrm-core.git] / xml / templates / dao.tpl
index 1c4f3c9e1dfb4fb4891f901c08da9cc019de93a5..4ba882ad1e69bb0d7b99668336052d00ec369ba8 100644 (file)
@@ -111,12 +111,12 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
 {foreach from=$table.fields item=field}
 
 {if $field.uniqueName}
-                                            '{$field.uniqueName}'
+  '{$field.uniqueName}'
 {else}
                                             '{$field.name}'
 {/if}
                => array(
-                                                                      'name'      => '{$field.name}',
+                 'name'      => '{$field.name}',
                                                                       'type'      => {$field.crmType},
 {if $field.title}
                                                                       'title'     => ts('{$field.title}'),
@@ -163,6 +163,10 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
 {if $field.default}
                          'default'   => '{if ($field.default[0]=="'" or $field.default[0]=='"')}{$field.default|substring:1:-1}{else}{$field.default}{/if}',
 {/if} {* field.default *}
+  'table_name' => '{$table.name}',
+  'entity' => '{$table.entity}',
+  'bao' => '{$table.bao}',
+  'localizable' => {if ($field.localizable)}{1}{else}{0}{/if},
 
 {if $field.FKClassName}
                       'FKClassName' => '{$field.FKClassName}',
@@ -181,8 +185,8 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
 'pseudoconstant' => array(
 {*{$pseudoOptions|@print_array}*}
 {foreach from=$pseudoOptions key=optionKey item=optionValue}
-                      '{$optionKey}' => '{$optionValue}',
-                      {/foreach}
+  '{$optionKey}' => '{$optionValue}',
+{/foreach}
                 )
 {/if} {* field.pseudoconstant *}                                                                    ),
 {/foreach} {* table.fields *}
@@ -259,6 +263,11 @@ class {$table.className} extends CRM_Core_DAO {ldelim}
             return $r;
       {rdelim}
 
+      /**
+       * Returns the list of indices
+       */
+      public static function indices($localize = TRUE) {ldelim}
+        $indices = {$indicesPhp};
+        return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
+      {rdelim}
 {rdelim}
-
-