API/DAO Metadata - Retain versioning metadata for possible usage in runtime+tooling
[civicrm-core.git] / CRM / Friend / DAO / Friend.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC https://civicrm.org/licensing
6 *
7 * Generated from xml/schema/CRM/Friend/Friend.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:ed3cb6458bdc4ee011d6b30baa9e24ff)
10 */
11
12 /**
13 * Database access object for the Friend entity.
14 */
15 class CRM_Friend_DAO_Friend extends CRM_Core_DAO {
16
17 /**
18 * Static instance to hold the table name.
19 *
20 * @var string
21 */
22 public static $_tableName = 'civicrm_tell_friend';
23
24 /**
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
26 *
27 * @var bool
28 */
29 public static $_log = FALSE;
30
31 /**
32 * Friend ID
33 *
34 * @var int
35 */
36 public $id;
37
38 /**
39 * Name of table where item being referenced is stored.
40 *
41 * @var string
42 */
43 public $entity_table;
44
45 /**
46 * Foreign key to the referenced item.
47 *
48 * @var int
49 */
50 public $entity_id;
51
52 /**
53 * @var string
54 */
55 public $title;
56
57 /**
58 * Introductory message to contributor or participant displayed on the Tell a Friend form.
59 *
60 * @var text
61 */
62 public $intro;
63
64 /**
65 * Suggested message to friends, provided as default on the Tell A Friend form.
66 *
67 * @var text
68 */
69 public $suggested_message;
70
71 /**
72 * URL for general info about the organization - included in the email sent to friends.
73 *
74 * @var string
75 */
76 public $general_link;
77
78 /**
79 * Text for Tell a Friend thank you page header and HTML title.
80 *
81 * @var string
82 */
83 public $thankyou_title;
84
85 /**
86 * Thank you message displayed on success page.
87 *
88 * @var text
89 */
90 public $thankyou_text;
91
92 /**
93 * @var bool
94 */
95 public $is_active;
96
97 /**
98 * Class constructor.
99 */
100 public function __construct() {
101 $this->__table = 'civicrm_tell_friend';
102 parent::__construct();
103 }
104
105 /**
106 * Returns localized title of this entity.
107 */
108 public static function getEntityTitle() {
109 return ts('Friends');
110 }
111
112 /**
113 * Returns foreign keys and entity references.
114 *
115 * @return array
116 * [CRM_Core_Reference_Interface]
117 */
118 public static function getReferenceColumns() {
119 if (!isset(Civi::$statics[__CLASS__]['links'])) {
120 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
121 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
122 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
123 }
124 return Civi::$statics[__CLASS__]['links'];
125 }
126
127 /**
128 * Returns all the column names of this table
129 *
130 * @return array
131 */
132 public static function &fields() {
133 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
134 Civi::$statics[__CLASS__]['fields'] = [
135 'id' => [
136 'name' => 'id',
137 'type' => CRM_Utils_Type::T_INT,
138 'title' => ts('Friend ID'),
139 'description' => ts('Friend ID'),
140 'required' => TRUE,
141 'where' => 'civicrm_tell_friend.id',
142 'table_name' => 'civicrm_tell_friend',
143 'entity' => 'Friend',
144 'bao' => 'CRM_Friend_BAO_Friend',
145 'localizable' => 0,
146 'add' => '2.0',
147 ],
148 'entity_table' => [
149 'name' => 'entity_table',
150 'type' => CRM_Utils_Type::T_STRING,
151 'title' => ts('Entity Table'),
152 'description' => ts('Name of table where item being referenced is stored.'),
153 'required' => TRUE,
154 'maxlength' => 64,
155 'size' => CRM_Utils_Type::BIG,
156 'where' => 'civicrm_tell_friend.entity_table',
157 'table_name' => 'civicrm_tell_friend',
158 'entity' => 'Friend',
159 'bao' => 'CRM_Friend_BAO_Friend',
160 'localizable' => 0,
161 'add' => '2.0',
162 ],
163 'entity_id' => [
164 'name' => 'entity_id',
165 'type' => CRM_Utils_Type::T_INT,
166 'title' => ts('Entity ID'),
167 'description' => ts('Foreign key to the referenced item.'),
168 'required' => TRUE,
169 'where' => 'civicrm_tell_friend.entity_id',
170 'table_name' => 'civicrm_tell_friend',
171 'entity' => 'Friend',
172 'bao' => 'CRM_Friend_BAO_Friend',
173 'localizable' => 0,
174 'add' => '2.0',
175 ],
176 'title' => [
177 'name' => 'title',
178 'type' => CRM_Utils_Type::T_STRING,
179 'title' => ts('Title'),
180 'maxlength' => 255,
181 'size' => CRM_Utils_Type::HUGE,
182 'where' => 'civicrm_tell_friend.title',
183 'table_name' => 'civicrm_tell_friend',
184 'entity' => 'Friend',
185 'bao' => 'CRM_Friend_BAO_Friend',
186 'localizable' => 1,
187 'html' => [
188 'type' => 'Text',
189 ],
190 'add' => '2.0',
191 ],
192 'intro' => [
193 'name' => 'intro',
194 'type' => CRM_Utils_Type::T_TEXT,
195 'title' => ts('Intro'),
196 'description' => ts('Introductory message to contributor or participant displayed on the Tell a Friend form.'),
197 'where' => 'civicrm_tell_friend.intro',
198 'table_name' => 'civicrm_tell_friend',
199 'entity' => 'Friend',
200 'bao' => 'CRM_Friend_BAO_Friend',
201 'localizable' => 1,
202 'html' => [
203 'type' => 'Text',
204 ],
205 'add' => '2.0',
206 ],
207 'suggested_message' => [
208 'name' => 'suggested_message',
209 'type' => CRM_Utils_Type::T_TEXT,
210 'title' => ts('Suggested Message'),
211 'description' => ts('Suggested message to friends, provided as default on the Tell A Friend form.'),
212 'where' => 'civicrm_tell_friend.suggested_message',
213 'table_name' => 'civicrm_tell_friend',
214 'entity' => 'Friend',
215 'bao' => 'CRM_Friend_BAO_Friend',
216 'localizable' => 1,
217 'html' => [
218 'type' => 'Text',
219 ],
220 'add' => '2.0',
221 ],
222 'general_link' => [
223 'name' => 'general_link',
224 'type' => CRM_Utils_Type::T_STRING,
225 'title' => ts('General Link'),
226 'description' => ts('URL for general info about the organization - included in the email sent to friends.'),
227 'maxlength' => 255,
228 'size' => CRM_Utils_Type::HUGE,
229 'import' => TRUE,
230 'where' => 'civicrm_tell_friend.general_link',
231 'export' => TRUE,
232 'table_name' => 'civicrm_tell_friend',
233 'entity' => 'Friend',
234 'bao' => 'CRM_Friend_BAO_Friend',
235 'localizable' => 0,
236 'html' => [
237 'type' => 'Text',
238 ],
239 'add' => '2.0',
240 ],
241 'thankyou_title' => [
242 'name' => 'thankyou_title',
243 'type' => CRM_Utils_Type::T_STRING,
244 'title' => ts('Thank You Title'),
245 'description' => ts('Text for Tell a Friend thank you page header and HTML title.'),
246 'maxlength' => 255,
247 'size' => CRM_Utils_Type::HUGE,
248 'where' => 'civicrm_tell_friend.thankyou_title',
249 'table_name' => 'civicrm_tell_friend',
250 'entity' => 'Friend',
251 'bao' => 'CRM_Friend_BAO_Friend',
252 'localizable' => 1,
253 'html' => [
254 'type' => 'Text',
255 ],
256 'add' => '2.0',
257 ],
258 'thankyou_text' => [
259 'name' => 'thankyou_text',
260 'type' => CRM_Utils_Type::T_TEXT,
261 'title' => ts('Thank You Text'),
262 'description' => ts('Thank you message displayed on success page.'),
263 'where' => 'civicrm_tell_friend.thankyou_text',
264 'table_name' => 'civicrm_tell_friend',
265 'entity' => 'Friend',
266 'bao' => 'CRM_Friend_BAO_Friend',
267 'localizable' => 1,
268 'html' => [
269 'type' => 'Text',
270 ],
271 'add' => '2.0',
272 ],
273 'is_active' => [
274 'name' => 'is_active',
275 'type' => CRM_Utils_Type::T_BOOLEAN,
276 'title' => ts('Enabled?'),
277 'where' => 'civicrm_tell_friend.is_active',
278 'table_name' => 'civicrm_tell_friend',
279 'entity' => 'Friend',
280 'bao' => 'CRM_Friend_BAO_Friend',
281 'localizable' => 0,
282 'html' => [
283 'type' => 'CheckBox',
284 ],
285 'add' => '2.0',
286 ],
287 ];
288 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
289 }
290 return Civi::$statics[__CLASS__]['fields'];
291 }
292
293 /**
294 * Return a mapping from field-name to the corresponding key (as used in fields()).
295 *
296 * @return array
297 * Array(string $name => string $uniqueName).
298 */
299 public static function &fieldKeys() {
300 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
301 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
302 }
303 return Civi::$statics[__CLASS__]['fieldKeys'];
304 }
305
306 /**
307 * Returns the names of this table
308 *
309 * @return string
310 */
311 public static function getTableName() {
312 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
313 }
314
315 /**
316 * Returns if this table needs to be logged
317 *
318 * @return bool
319 */
320 public function getLog() {
321 return self::$_log;
322 }
323
324 /**
325 * Returns the list of fields that can be imported
326 *
327 * @param bool $prefix
328 *
329 * @return array
330 */
331 public static function &import($prefix = FALSE) {
332 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, []);
333 return $r;
334 }
335
336 /**
337 * Returns the list of fields that can be exported
338 *
339 * @param bool $prefix
340 *
341 * @return array
342 */
343 public static function &export($prefix = FALSE) {
344 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, []);
345 return $r;
346 }
347
348 /**
349 * Returns the list of indices
350 *
351 * @param bool $localize
352 *
353 * @return array
354 */
355 public static function indices($localize = TRUE) {
356 $indices = [];
357 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
358 }
359
360 }