Merge pull request #9632 from yashodha/CRM-19795
[civicrm-core.git] / CRM / Contribute / DAO / ContributionPage.php
index 50398144500a605989d8d5843399bfde3e665ba9..ecbd020a73b57ef9f9afa83cc521392750dea1e7 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.                                    |
 |                                                                    |
@@ -26,7 +26,7 @@
 */
 /**
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
  *
  * Generated from xml/schema/CRM/Contribute/ContributionPage.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
@@ -41,38 +41,6 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
    * @var string
    */
   static $_tableName = 'civicrm_contribution_page';
-  /**
-   * 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
@@ -366,13 +334,14 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
    *   [CRM_Core_Reference_Interface]
    */
   static function getReferenceColumns() {
-    if (!self::$_links) {
-      self::$_links = static ::createReferenceColumns(__CLASS__);
-      self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', 'id');
-      self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
-      self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', '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() , 'financial_type_id', 'civicrm_financial_type', 'id');
+      Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
+      Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', '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
@@ -380,8 +349,8 @@ class CRM_Contribute_DAO_ContributionPage 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,
@@ -753,66 +722,21 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
           'description' => 'if true - billing block is required for online contribution page',
         ) ,
       );
+      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',
-        'title' => 'title',
-        'intro_text' => 'intro_text',
-        'financial_type_id' => 'financial_type_id',
-        'payment_processor' => 'payment_processor',
-        'is_credit_card_only' => 'is_credit_card_only',
-        'is_monetary' => 'is_monetary',
-        'is_recur' => 'is_recur',
-        'is_confirm_enabled' => 'is_confirm_enabled',
-        'recur_frequency_unit' => 'recur_frequency_unit',
-        'is_recur_interval' => 'is_recur_interval',
-        'is_recur_installments' => 'is_recur_installments',
-        'adjust_recur_start_date' => 'adjust_recur_start_date',
-        'is_pay_later' => 'is_pay_later',
-        'pay_later_text' => 'pay_later_text',
-        'pay_later_receipt' => 'pay_later_receipt',
-        'is_partial_payment' => 'is_partial_payment',
-        'initial_amount_label' => 'initial_amount_label',
-        'initial_amount_help_text' => 'initial_amount_help_text',
-        'min_initial_amount' => 'min_initial_amount',
-        'is_allow_other_amount' => 'is_allow_other_amount',
-        'default_amount_id' => 'default_amount_id',
-        'min_amount' => 'min_amount',
-        'max_amount' => 'max_amount',
-        'goal_amount' => 'goal_amount',
-        'thankyou_title' => 'thankyou_title',
-        'thankyou_text' => 'thankyou_text',
-        'thankyou_footer' => 'thankyou_footer',
-        'is_email_receipt' => 'is_email_receipt',
-        'receipt_from_name' => 'receipt_from_name',
-        'receipt_from_email' => 'receipt_from_email',
-        'cc_receipt' => 'cc_receipt',
-        'bcc_receipt' => 'bcc_receipt',
-        'receipt_text' => 'receipt_text',
-        'is_active' => 'is_active',
-        'footer_text' => 'footer_text',
-        'amount_block_is_active' => 'amount_block_is_active',
-        'start_date' => 'start_date',
-        'end_date' => 'end_date',
-        'created_id' => 'created_id',
-        'created_date' => 'created_date',
-        'currency' => 'currency',
-        'campaign_id' => 'campaign_id',
-        'is_share' => 'is_share',
-        'is_billing_required' => 'is_billing_required',
-      );
+    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
@@ -838,20 +762,8 @@ class CRM_Contribute_DAO_ContributionPage 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['contribution_page'] = & $fields[$name];
-          } else {
-            self::$_import[$name] = & $fields[$name];
-          }
-        }
-      }
-    }
-    return self::$_import;
+    $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'contribution_page', $prefix, array());
+    return $r;
   }
   /**
    * Returns the list of fields that can be exported
@@ -861,19 +773,7 @@ class CRM_Contribute_DAO_ContributionPage 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['contribution_page'] = & $fields[$name];
-          } else {
-            self::$_export[$name] = & $fields[$name];
-          }
-        }
-      }
-    }
-    return self::$_export;
+    $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'contribution_page', $prefix, array());
+    return $r;
   }
 }