X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FDAO%2FWebsite.php;h=c04526369cfb33167344339ebd6e857c26ac040d;hb=522a26c97d574d2ce6f88c729fa01998ed203794;hp=0aeaffe4675a31b565f1be056454ad8ee7477edf;hpb=437fafcfbc5284ebe4225d58a235cc6d8882dda8;p=civicrm-core.git diff --git a/CRM/Core/DAO/Website.php b/CRM/Core/DAO/Website.php index 0aeaffe467..c04526369c 100644 --- a/CRM/Core/DAO/Website.php +++ b/CRM/Core/DAO/Website.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,56 +26,26 @@ */ /** * @package CRM - * @copyright CiviCRM LLC (c) 2004-2016 + * @copyright CiviCRM LLC (c) 2004-2017 * * Generated from xml/schema/CRM/Core/Website.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:40a585fbb41385458f0332b03388c078) + * (GenCodeChecksum:42189dd53f14c27bba3cc5f498ad1324) */ require_once 'CRM/Core/DAO.php'; require_once 'CRM/Utils/Type.php'; +/** + * CRM_Core_DAO_Website constructor. + */ class CRM_Core_DAO_Website extends CRM_Core_DAO { /** - * static instance to hold the table name + * Static instance to hold the table name. * * @var string */ static $_tableName = 'civicrm_website'; /** - * 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 */ @@ -105,26 +75,25 @@ class CRM_Core_DAO_Website extends CRM_Core_DAO { */ public $website_type_id; /** - * class constructor - * - * @return civicrm_website + * Class constructor. */ function __construct() { $this->__table = 'civicrm_website'; 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() , 'contact_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() , 'contact_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 @@ -132,20 +101,26 @@ class CRM_Core_DAO_Website 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('Website ID') , 'description' => 'Unique Website ID', 'required' => true, + 'table_name' => 'civicrm_website', + 'entity' => 'Website', + 'bao' => 'CRM_Core_BAO_Website', ) , 'contact_id' => array( 'name' => 'contact_id', 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Contact') , 'description' => 'FK to Contact ID', + 'table_name' => 'civicrm_website', + 'entity' => 'Website', + 'bao' => 'CRM_Core_BAO_Website', 'FKClassName' => 'CRM_Contact_DAO_Contact', ) , 'url' => array( @@ -160,6 +135,9 @@ class CRM_Core_DAO_Website extends CRM_Core_DAO { 'headerPattern' => '/Website/i', 'dataPattern' => '/^[A-Za-z][0-9A-Za-z]{20,}$/', 'export' => true, + 'table_name' => 'civicrm_website', + 'entity' => 'Website', + 'bao' => 'CRM_Core_BAO_Website', 'html' => array( 'type' => 'Text', ) , @@ -169,6 +147,9 @@ class CRM_Core_DAO_Website extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Website Type') , 'description' => 'Which Website type does this website belong to.', + 'table_name' => 'civicrm_website', + 'entity' => 'Website', + 'bao' => 'CRM_Core_BAO_Website', 'html' => array( 'type' => 'Select', ) , @@ -178,25 +159,21 @@ class CRM_Core_DAO_Website 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', - 'contact_id' => 'contact_id', - 'url' => 'url', - 'website_type_id' => 'website_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 @@ -222,20 +199,8 @@ class CRM_Core_DAO_Website 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['website'] = & $fields[$name]; - } else { - self::$_import[$name] = & $fields[$name]; - } - } - } - } - return self::$_import; + $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'website', $prefix, array()); + return $r; } /** * Returns the list of fields that can be exported @@ -245,19 +210,7 @@ class CRM_Core_DAO_Website 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['website'] = & $fields[$name]; - } else { - self::$_export[$name] = & $fields[$name]; - } - } - } - } - return self::$_export; + $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'website', $prefix, array()); + return $r; } }