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