Fixed CRM-20330: provided a way to generate a table with a composite primary key...
[civicrm-core.git] / CRM / Core / DAO / PreferencesDate.php
CommitLineData
e501603b
TO
1<?php
2/*
3+--------------------------------------------------------------------+
4| CiviCRM version 4.7 |
5+--------------------------------------------------------------------+
0f03f337 6| Copyright CiviCRM LLC (c) 2004-2017 |
e501603b
TO
7+--------------------------------------------------------------------+
8| This file is a part of CiviCRM. |
9| |
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. |
13| |
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. |
18| |
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+--------------------------------------------------------------------+
26*/
27/**
28 * @package CRM
0f03f337 29 * @copyright CiviCRM LLC (c) 2004-2017
e501603b
TO
30 *
31 * Generated from xml/schema/CRM/Core/PreferencesDate.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:c6c3c0c91ca3f33fa11b89fb6e2dd704)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Core_DAO_PreferencesDate constructor.
39 */
e501603b
TO
40class CRM_Core_DAO_PreferencesDate extends CRM_Core_DAO {
41 /**
f41f0342 42 * Static instance to hold the table name.
e501603b
TO
43 *
44 * @var string
45 */
46 static $_tableName = 'civicrm_preferences_date';
e501603b 47 /**
f41f0342 48 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b
TO
49 *
50 * @var boolean
51 */
52 static $_log = true;
53 /**
54 *
55 * @var int unsigned
56 */
57 public $id;
58 /**
59 * The meta name for this date (fixed in code)
60 *
61 * @var string
62 */
63 public $name;
64 /**
65 * Description of this date type.
66 *
67 * @var string
68 */
69 public $description;
70 /**
71 * The start offset relative to current year
72 *
73 * @var int
74 */
75 public $start;
76 /**
77 * The end offset relative to current year, can be negative
78 *
79 * @var int
80 */
81 public $end;
82 /**
83 * The date type
84 *
85 * @var string
86 */
87 public $date_format;
88 /**
89 * time format
90 *
91 * @var string
92 */
93 public $time_format;
94 /**
f41f0342 95 * Class constructor.
e501603b
TO
96 */
97 function __construct() {
98 $this->__table = 'civicrm_preferences_date';
99 parent::__construct();
100 }
101 /**
102 * Returns all the column names of this table
103 *
104 * @return array
105 */
106 static function &fields() {
346aaaba
TO
107 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
108 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
109 'id' => array(
110 'name' => 'id',
111 'type' => CRM_Utils_Type::T_INT,
112 'title' => ts('Date Preference ID') ,
113 'required' => true,
522a26c9 114 'table_name' => 'civicrm_preferences_date',
115 'entity' => 'PreferencesDate',
116 'bao' => 'CRM_Core_BAO_PreferencesDate',
e501603b
TO
117 ) ,
118 'name' => array(
119 'name' => 'name',
120 'type' => CRM_Utils_Type::T_STRING,
121 'title' => ts('Date Preference Name') ,
122 'description' => 'The meta name for this date (fixed in code)',
123 'required' => true,
124 'maxlength' => 64,
125 'size' => CRM_Utils_Type::BIG,
522a26c9 126 'table_name' => 'civicrm_preferences_date',
127 'entity' => 'PreferencesDate',
128 'bao' => 'CRM_Core_BAO_PreferencesDate',
e501603b
TO
129 ) ,
130 'description' => array(
131 'name' => 'description',
132 'type' => CRM_Utils_Type::T_STRING,
133 'title' => ts('Description') ,
134 'description' => 'Description of this date type.',
135 'maxlength' => 255,
136 'size' => CRM_Utils_Type::HUGE,
522a26c9 137 'table_name' => 'civicrm_preferences_date',
138 'entity' => 'PreferencesDate',
139 'bao' => 'CRM_Core_BAO_PreferencesDate',
e501603b
TO
140 ) ,
141 'start' => array(
142 'name' => 'start',
143 'type' => CRM_Utils_Type::T_INT,
144 'title' => ts('Start') ,
145 'description' => 'The start offset relative to current year',
146 'required' => true,
522a26c9 147 'table_name' => 'civicrm_preferences_date',
148 'entity' => 'PreferencesDate',
149 'bao' => 'CRM_Core_BAO_PreferencesDate',
e501603b
TO
150 ) ,
151 'end' => array(
152 'name' => 'end',
153 'type' => CRM_Utils_Type::T_INT,
154 'title' => ts('End Offset') ,
155 'description' => 'The end offset relative to current year, can be negative',
156 'required' => true,
522a26c9 157 'table_name' => 'civicrm_preferences_date',
158 'entity' => 'PreferencesDate',
159 'bao' => 'CRM_Core_BAO_PreferencesDate',
e501603b
TO
160 ) ,
161 'date_format' => array(
162 'name' => 'date_format',
163 'type' => CRM_Utils_Type::T_STRING,
164 'title' => ts('Date Format') ,
165 'description' => 'The date type',
166 'maxlength' => 64,
167 'size' => CRM_Utils_Type::BIG,
522a26c9 168 'table_name' => 'civicrm_preferences_date',
169 'entity' => 'PreferencesDate',
170 'bao' => 'CRM_Core_BAO_PreferencesDate',
e501603b
TO
171 ) ,
172 'time_format' => array(
173 'name' => 'time_format',
174 'type' => CRM_Utils_Type::T_STRING,
175 'title' => ts('Time Format') ,
176 'description' => 'time format',
177 'maxlength' => 64,
178 'size' => CRM_Utils_Type::BIG,
522a26c9 179 'table_name' => 'civicrm_preferences_date',
180 'entity' => 'PreferencesDate',
181 'bao' => 'CRM_Core_BAO_PreferencesDate',
e501603b
TO
182 ) ,
183 );
346aaaba 184 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 185 }
346aaaba 186 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
187 }
188 /**
bd8e0b14 189 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
190 *
191 * @return array
bd8e0b14 192 * Array(string $name => string $uniqueName).
e501603b
TO
193 */
194 static function &fieldKeys() {
bd8e0b14
TO
195 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
196 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 197 }
bd8e0b14 198 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
199 }
200 /**
201 * Returns the names of this table
202 *
203 * @return string
204 */
205 static function getTableName() {
206 return self::$_tableName;
207 }
208 /**
209 * Returns if this table needs to be logged
210 *
211 * @return boolean
212 */
213 function getLog() {
214 return self::$_log;
215 }
216 /**
217 * Returns the list of fields that can be imported
218 *
219 * @param bool $prefix
220 *
221 * @return array
222 */
223 static function &import($prefix = false) {
60808919
TO
224 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'preferences_date', $prefix, array());
225 return $r;
e501603b
TO
226 }
227 /**
228 * Returns the list of fields that can be exported
229 *
230 * @param bool $prefix
231 *
232 * @return array
233 */
234 static function &export($prefix = false) {
60808919
TO
235 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'preferences_date', $prefix, array());
236 return $r;
e501603b
TO
237 }
238}