3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * @copyright CiviCRM LLC (c) 2004-2016
31 * Generated from xml/schema/CRM/Core/StateProvince.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:eb9f2b5e6268fe81bf226acdc126d0dd)
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Core_DAO_StateProvince
extends CRM_Core_DAO
{
39 * static instance to hold the table name
43 static $_tableName = 'civicrm_state_province';
45 * static instance to hold the field values
49 static $_fields = null;
51 * static instance to hold the keys used in $_fields for each field.
55 static $_fieldKeys = null;
57 * static instance to hold the FK relationships
61 static $_links = null;
63 * static instance to hold the values that can
68 static $_import = null;
70 * static instance to hold the values that can
75 static $_export = null;
77 * static value to see if we should log any modifications to
78 * this table in the civicrm_log table
90 * Name of State/Province
96 * 2-4 Character Abbreviation of State/Province
100 public $abbreviation;
102 * ID of Country that State/Province belong
110 * @return civicrm_state_province
112 function __construct() {
113 $this->__table
= 'civicrm_state_province';
114 parent
::__construct();
117 * Returns foreign keys and entity references
120 * [CRM_Core_Reference_Interface]
122 static function getReferenceColumns() {
123 if (!self
::$_links) {
124 self
::$_links = static ::createReferenceColumns(__CLASS__
);
125 self
::$_links[] = new CRM_Core_Reference_Basic(self
::getTableName() , 'country_id', 'civicrm_country', 'id');
127 return self
::$_links;
130 * Returns all the column names of this table
134 static function &fields() {
135 if (!(self
::$_fields)) {
136 self
::$_fields = array(
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('State ID') ,
141 'description' => 'State/Province ID',
146 'type' => CRM_Utils_Type
::T_STRING
,
147 'title' => ts('State') ,
148 'description' => 'Name of State/Province',
150 'size' => CRM_Utils_Type
::BIG
,
152 'where' => 'civicrm_state_province.name',
153 'headerPattern' => '/state|prov(ince)?/i',
154 'dataPattern' => '/[A-Z]{2}/',
157 'abbreviation' => array(
158 'name' => 'abbreviation',
159 'type' => CRM_Utils_Type
::T_STRING
,
160 'title' => ts('State Abbreviation') ,
161 'description' => '2-4 Character Abbreviation of State/Province',
163 'size' => CRM_Utils_Type
::FOUR
,
165 'country_id' => array(
166 'name' => 'country_id',
167 'type' => CRM_Utils_Type
::T_INT
,
168 'title' => ts('County') ,
169 'description' => 'ID of Country that State/Province belong',
171 'FKClassName' => 'CRM_Core_DAO_Country',
175 return self
::$_fields;
178 * Returns an array containing, for each field, the arary key used for that
179 * field in self::$_fields.
183 static function &fieldKeys() {
184 if (!(self
::$_fieldKeys)) {
185 self
::$_fieldKeys = array(
188 'abbreviation' => 'abbreviation',
189 'country_id' => 'country_id',
192 return self
::$_fieldKeys;
195 * Returns the names of this table
199 static function getTableName() {
200 return self
::$_tableName;
203 * Returns if this table needs to be logged
211 * Returns the list of fields that can be imported
213 * @param bool $prefix
217 static function &import($prefix = false) {
218 if (!(self
::$_import)) {
219 self
::$_import = array();
220 $fields = self
::fields();
221 foreach($fields as $name => $field) {
222 if (CRM_Utils_Array
::value('import', $field)) {
224 self
::$_import['state_province'] = & $fields[$name];
226 self
::$_import[$name] = & $fields[$name];
231 return self
::$_import;
234 * Returns the list of fields that can be exported
236 * @param bool $prefix
240 static function &export($prefix = false) {
241 if (!(self
::$_export)) {
242 self
::$_export = array();
243 $fields = self
::fields();
244 foreach($fields as $name => $field) {
245 if (CRM_Utils_Array
::value('export', $field)) {
247 self
::$_export['state_province'] = & $fields[$name];
249 self
::$_export[$name] = & $fields[$name];
254 return self
::$_export;