CRM-19925 Updated DAO files
[civicrm-core.git] / CRM / Core / DAO / CustomGroup.php
index 6447fc553ce1f366bce1760a32ad176cb5445bd3..4eede3724b97c3871ad041e956c181a8d24e7da6 100644 (file)
@@ -3,7 +3,7 @@
 +--------------------------------------------------------------------+
 | CiviCRM version 4.7                                                |
 +--------------------------------------------------------------------+
-| Copyright CiviCRM LLC (c) 2004-2016                                |
+| Copyright CiviCRM LLC (c) 2004-2017                                |
 +--------------------------------------------------------------------+
 | This file is a part of CiviCRM.                                    |
 |                                                                    |
 */
 /**
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
  *
  * Generated from xml/schema/CRM/Core/CustomGroup.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:01465947abefe26da02c4a81505afe08)
+ * (GenCodeChecksum:190b0c5691831c6708b5de7ce556836d)
  */
 require_once 'CRM/Core/DAO.php';
 require_once 'CRM/Utils/Type.php';
+/**
+ * CRM_Core_DAO_CustomGroup constructor.
+ */
 class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
   /**
-   * static instance to hold the table name
+   * Static instance to hold the table name.
    *
    * @var string
    */
   static $_tableName = 'civicrm_custom_group';
   /**
-   * static instance to hold the field values
-   *
-   * @var array
-   */
-  static $_fields = null;
-  /**
-   * static instance to hold the keys used in $_fields for each field.
-   *
-   * @var array
-   */
-  static $_fieldKeys = null;
-  /**
-   * static instance to hold the FK relationships
-   *
-   * @var string
-   */
-  static $_links = null;
-  /**
-   * static instance to hold the values that can
-   * be imported
-   *
-   * @var array
-   */
-  static $_import = null;
-  /**
-   * static instance to hold the values that can
-   * be exported
-   *
-   * @var array
-   */
-  static $_export = null;
-  /**
-   * static value to see if we should log any modifications to
-   * this table in the civicrm_log table
+   * Should CiviCRM log any modifications to this table in the civicrm_log table.
    *
    * @var boolean
    */
@@ -201,26 +171,25 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
    */
   public $is_reserved;
   /**
-   * class constructor
-   *
-   * @return civicrm_custom_group
+   * Class constructor.
    */
   function __construct() {
     $this->__table = 'civicrm_custom_group';
     parent::__construct();
   }
   /**
-   * Returns foreign keys and entity references
+   * Returns foreign keys and entity references.
    *
    * @return array
    *   [CRM_Core_Reference_Interface]
    */
   static function getReferenceColumns() {
-    if (!self::$_links) {
-      self::$_links = static ::createReferenceColumns(__CLASS__);
-      self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
+    if (!isset(Civi::$statics[__CLASS__]['links'])) {
+      Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
+      Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
+      CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
     }
-    return self::$_links;
+    return Civi::$statics[__CLASS__]['links'];
   }
   /**
    * Returns all the column names of this table
@@ -228,14 +197,17 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
    * @return array
    */
   static function &fields() {
-    if (!(self::$_fields)) {
-      self::$_fields = array(
+    if (!isset(Civi::$statics[__CLASS__]['fields'])) {
+      Civi::$statics[__CLASS__]['fields'] = array(
         'id' => array(
           'name' => 'id',
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Custom Group ID') ,
           'description' => 'Unique Custom Group ID',
           'required' => true,
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'name' => array(
           'name' => 'name',
@@ -244,6 +216,9 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'description' => 'Variable name/programmatic handle for this group.',
           'maxlength' => 64,
           'size' => CRM_Utils_Type::BIG,
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'title' => array(
           'name' => 'title',
@@ -253,6 +228,9 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'required' => true,
           'maxlength' => 64,
           'size' => CRM_Utils_Type::BIG,
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'extends' => array(
           'name' => 'extends',
@@ -262,6 +240,9 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
           'default' => 'Contact',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'extends_entity_column_id' => array(
           'name' => 'extends_entity_column_id',
@@ -269,6 +250,9 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'title' => ts('Custom Group Subtype List') ,
           'description' => 'FK to civicrm_option_value.id (for option group custom_data_type.)',
           'default' => 'NULL',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'extends_entity_column_value' => array(
           'name' => 'extends_entity_column_value',
@@ -277,6 +261,9 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'description' => 'linking custom group for dynamic object',
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'style' => array(
           'name' => 'style',
@@ -285,6 +272,9 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'description' => 'Visual relationship between this form and its parent.',
           'maxlength' => 15,
           'size' => CRM_Utils_Type::TWELVE,
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
           'html' => array(
             'type' => 'Select',
           ) ,
@@ -297,6 +287,9 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Collapse Custom Group?') ,
           'description' => 'Will this group be in collapsed or expanded mode on initial display ?',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'help_pre' => array(
           'name' => 'help_pre',
@@ -305,6 +298,9 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'description' => 'Description and/or help text to display before fields in form.',
           'rows' => 4,
           'cols' => 80,
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
           'html' => array(
             'type' => 'TextArea',
           ) ,
@@ -316,6 +312,9 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'description' => 'Description and/or help text to display after fields in form.',
           'rows' => 4,
           'cols' => 80,
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
           'html' => array(
             'type' => 'TextArea',
           ) ,
@@ -327,12 +326,18 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'description' => 'Controls display order when multiple extended property groups are setup for the same class.',
           'required' => true,
           'default' => '1',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'is_active' => array(
           'name' => 'is_active',
           'type' => CRM_Utils_Type::T_BOOLEAN,
           'title' => ts('Custom Group Is Active?') ,
           'description' => 'Is this property active?',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'table_name' => array(
           'name' => 'table_name',
@@ -341,36 +346,54 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'description' => 'Name of the table that holds the values for this group.',
           'maxlength' => 255,
           'size' => CRM_Utils_Type::HUGE,
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'is_multiple' => array(
           'name' => 'is_multiple',
           'type' => CRM_Utils_Type::T_BOOLEAN,
           'title' => ts('Supports Multiple Records') ,
           'description' => 'Does this group hold multiple values?',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'min_multiple' => array(
           'name' => 'min_multiple',
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Minimum Multiple Records') ,
           'description' => 'minimum number of multiple records (typically 0?)',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'max_multiple' => array(
           'name' => 'max_multiple',
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Maximum Multiple Records') ,
           'description' => 'maximum number of multiple records, if 0 - no max',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'collapse_adv_display' => array(
           'name' => 'collapse_adv_display',
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Collapse Group Display') ,
           'description' => 'Will this group be in collapsed or expanded mode on advanced search display ?',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'created_id' => array(
           'name' => 'created_id',
           'type' => CRM_Utils_Type::T_INT,
           'title' => ts('Custom Group Created By') ,
           'description' => 'FK to civicrm_contact, who created this custom group',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
           'FKClassName' => 'CRM_Contact_DAO_Contact',
         ) ,
         'created_date' => array(
@@ -378,49 +401,35 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
           'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
           'title' => ts('Custom Group Created Date') ,
           'description' => 'Date and time this custom group was created.',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
         'is_reserved' => array(
           'name' => 'is_reserved',
           'type' => CRM_Utils_Type::T_BOOLEAN,
           'title' => ts('Reserved Group?') ,
           'description' => 'Is this a reserved Custom Group?',
+          'table_name' => 'civicrm_custom_group',
+          'entity' => 'CustomGroup',
+          'bao' => 'CRM_Core_BAO_CustomGroup',
         ) ,
       );
+      CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
     }
-    return self::$_fields;
+    return Civi::$statics[__CLASS__]['fields'];
   }
   /**
-   * Returns an array containing, for each field, the arary key used for that
-   * field in self::$_fields.
+   * Return a mapping from field-name to the corresponding key (as used in fields()).
    *
    * @return array
+   *   Array(string $name => string $uniqueName).
    */
   static function &fieldKeys() {
-    if (!(self::$_fieldKeys)) {
-      self::$_fieldKeys = array(
-        'id' => 'id',
-        'name' => 'name',
-        'title' => 'title',
-        'extends' => 'extends',
-        'extends_entity_column_id' => 'extends_entity_column_id',
-        'extends_entity_column_value' => 'extends_entity_column_value',
-        'style' => 'style',
-        'collapse_display' => 'collapse_display',
-        'help_pre' => 'help_pre',
-        'help_post' => 'help_post',
-        'weight' => 'weight',
-        'is_active' => 'is_active',
-        'table_name' => 'table_name',
-        'is_multiple' => 'is_multiple',
-        'min_multiple' => 'min_multiple',
-        'max_multiple' => 'max_multiple',
-        'collapse_adv_display' => 'collapse_adv_display',
-        'created_id' => 'created_id',
-        'created_date' => 'created_date',
-        'is_reserved' => 'is_reserved',
-      );
+    if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
+      Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
     }
-    return self::$_fieldKeys;
+    return Civi::$statics[__CLASS__]['fieldKeys'];
   }
   /**
    * Returns the names of this table
@@ -446,20 +455,8 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
    * @return array
    */
   static function &import($prefix = false) {
-    if (!(self::$_import)) {
-      self::$_import = array();
-      $fields = self::fields();
-      foreach($fields as $name => $field) {
-        if (CRM_Utils_Array::value('import', $field)) {
-          if ($prefix) {
-            self::$_import['custom_group'] = & $fields[$name];
-          } else {
-            self::$_import[$name] = & $fields[$name];
-          }
-        }
-      }
-    }
-    return self::$_import;
+    $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'custom_group', $prefix, array());
+    return $r;
   }
   /**
    * Returns the list of fields that can be exported
@@ -469,19 +466,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO {
    * @return array
    */
   static function &export($prefix = false) {
-    if (!(self::$_export)) {
-      self::$_export = array();
-      $fields = self::fields();
-      foreach($fields as $name => $field) {
-        if (CRM_Utils_Array::value('export', $field)) {
-          if ($prefix) {
-            self::$_export['custom_group'] = & $fields[$name];
-          } else {
-            self::$_export[$name] = & $fields[$name];
-          }
-        }
-      }
-    }
-    return self::$_export;
+    $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'custom_group', $prefix, array());
+    return $r;
   }
 }