X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FDAO%2FPremiumsProduct.php;h=d14870af62ca3dcd0cdca3c1236a9864ef668d06;hb=63d66a39cb391e4db0f16724908f3e837c2f1c7e;hp=60a7593d5e695353222b508df94c932c8b16310a;hpb=e501603bcc6d86d85326809a48ce758cacaaa793;p=civicrm-core.git diff --git a/CRM/Contribute/DAO/PremiumsProduct.php b/CRM/Contribute/DAO/PremiumsProduct.php index 60a7593d5e..d14870af62 100644 --- a/CRM/Contribute/DAO/PremiumsProduct.php +++ b/CRM/Contribute/DAO/PremiumsProduct.php @@ -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,11 +26,11 @@ */ /** * @package CRM - * @copyright CiviCRM LLC (c) 2004-2016 + * @copyright CiviCRM LLC (c) 2004-2017 * * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:16f76907bbd9142b5c8e4820a4bdba34) + * (GenCodeChecksum:3580529cebca0659c28e8d4f55015c22) */ require_once 'CRM/Core/DAO.php'; require_once 'CRM/Utils/Type.php'; @@ -41,38 +41,6 @@ class CRM_Contribute_DAO_PremiumsProduct extends CRM_Core_DAO { * @var string */ static $_tableName = 'civicrm_premiums_product'; - /** - * 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 @@ -125,13 +93,14 @@ class CRM_Contribute_DAO_PremiumsProduct 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() , 'premiums_id', 'civicrm_premiums', 'id'); - self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'product_id', 'civicrm_product', 'id'); - self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', '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() , 'premiums_id', 'civicrm_premiums', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'product_id', 'civicrm_product', 'id'); + Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName() , 'financial_type_id', 'civicrm_financial_type', '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 @@ -139,8 +108,8 @@ class CRM_Contribute_DAO_PremiumsProduct 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, @@ -184,26 +153,21 @@ class CRM_Contribute_DAO_PremiumsProduct extends CRM_Core_DAO { ) ) , ); + 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', - 'premiums_id' => 'premiums_id', - 'product_id' => 'product_id', - 'weight' => 'weight', - 'financial_type_id' => 'financial_type_id', - ); + 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 @@ -229,20 +193,8 @@ class CRM_Contribute_DAO_PremiumsProduct 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['premiums_product'] = & $fields[$name]; - } else { - self::$_import[$name] = & $fields[$name]; - } - } - } - } - return self::$_import; + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'premiums_product', $prefix, array()); + return $r; } /** * Returns the list of fields that can be exported @@ -252,19 +204,7 @@ class CRM_Contribute_DAO_PremiumsProduct 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['premiums_product'] = & $fields[$name]; - } else { - self::$_export[$name] = & $fields[$name]; - } - } - } - } - return self::$_export; + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'premiums_product', $prefix, array()); + return $r; } }