(NFC) (dev/core#878) Simplify '@copyright' annotation
[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:8218c3da1a68f90b534e4724bd0b89b1)
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 foreign keys and entity references.
107 *
108 * @return array
109 * [CRM_Core_Reference_Interface]
110 */
111 public static function getReferenceColumns() {
112 if (!isset(Civi::$statics[__CLASS__]['links'])) {
113 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
114 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
115 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
116 }
117 return Civi::$statics[__CLASS__]['links'];
118 }
119
120 /**
121 * Returns all the column names of this table
122 *
123 * @return array
124 */
125 public static function &fields() {
126 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
127 Civi::$statics[__CLASS__]['fields'] = [
128 'id' => [
129 'name' => 'id',
130 'type' => CRM_Utils_Type::T_INT,
131 'title' => ts('Friend ID'),
132 'description' => ts('Friend ID'),
133 'required' => TRUE,
134 'where' => 'civicrm_tell_friend.id',
135 'table_name' => 'civicrm_tell_friend',
136 'entity' => 'Friend',
137 'bao' => 'CRM_Friend_BAO_Friend',
138 'localizable' => 0,
139 ],
140 'entity_table' => [
141 'name' => 'entity_table',
142 'type' => CRM_Utils_Type::T_STRING,
143 'title' => ts('Entity Table'),
144 'description' => ts('Name of table where item being referenced is stored.'),
145 'required' => TRUE,
146 'maxlength' => 64,
147 'size' => CRM_Utils_Type::BIG,
148 'where' => 'civicrm_tell_friend.entity_table',
149 'table_name' => 'civicrm_tell_friend',
150 'entity' => 'Friend',
151 'bao' => 'CRM_Friend_BAO_Friend',
152 'localizable' => 0,
153 ],
154 'entity_id' => [
155 'name' => 'entity_id',
156 'type' => CRM_Utils_Type::T_INT,
157 'title' => ts('Entity ID'),
158 'description' => ts('Foreign key to the referenced item.'),
159 'required' => TRUE,
160 'where' => 'civicrm_tell_friend.entity_id',
161 'table_name' => 'civicrm_tell_friend',
162 'entity' => 'Friend',
163 'bao' => 'CRM_Friend_BAO_Friend',
164 'localizable' => 0,
165 ],
166 'title' => [
167 'name' => 'title',
168 'type' => CRM_Utils_Type::T_STRING,
169 'title' => ts('Title'),
170 'maxlength' => 255,
171 'size' => CRM_Utils_Type::HUGE,
172 'where' => 'civicrm_tell_friend.title',
173 'table_name' => 'civicrm_tell_friend',
174 'entity' => 'Friend',
175 'bao' => 'CRM_Friend_BAO_Friend',
176 'localizable' => 1,
177 'html' => [
178 'type' => 'Text',
179 ],
180 ],
181 'intro' => [
182 'name' => 'intro',
183 'type' => CRM_Utils_Type::T_TEXT,
184 'title' => ts('Intro'),
185 'description' => ts('Introductory message to contributor or participant displayed on the Tell a Friend form.'),
186 'where' => 'civicrm_tell_friend.intro',
187 'table_name' => 'civicrm_tell_friend',
188 'entity' => 'Friend',
189 'bao' => 'CRM_Friend_BAO_Friend',
190 'localizable' => 1,
191 'html' => [
192 'type' => 'Text',
193 ],
194 ],
195 'suggested_message' => [
196 'name' => 'suggested_message',
197 'type' => CRM_Utils_Type::T_TEXT,
198 'title' => ts('Suggested Message'),
199 'description' => ts('Suggested message to friends, provided as default on the Tell A Friend form.'),
200 'where' => 'civicrm_tell_friend.suggested_message',
201 'table_name' => 'civicrm_tell_friend',
202 'entity' => 'Friend',
203 'bao' => 'CRM_Friend_BAO_Friend',
204 'localizable' => 1,
205 'html' => [
206 'type' => 'Text',
207 ],
208 ],
209 'general_link' => [
210 'name' => 'general_link',
211 'type' => CRM_Utils_Type::T_STRING,
212 'title' => ts('General Link'),
213 'description' => ts('URL for general info about the organization - included in the email sent to friends.'),
214 'maxlength' => 255,
215 'size' => CRM_Utils_Type::HUGE,
216 'import' => TRUE,
217 'where' => 'civicrm_tell_friend.general_link',
218 'export' => TRUE,
219 'table_name' => 'civicrm_tell_friend',
220 'entity' => 'Friend',
221 'bao' => 'CRM_Friend_BAO_Friend',
222 'localizable' => 0,
223 'html' => [
224 'type' => 'Text',
225 ],
226 ],
227 'thankyou_title' => [
228 'name' => 'thankyou_title',
229 'type' => CRM_Utils_Type::T_STRING,
230 'title' => ts('Thank You Title'),
231 'description' => ts('Text for Tell a Friend thank you page header and HTML title.'),
232 'maxlength' => 255,
233 'size' => CRM_Utils_Type::HUGE,
234 'where' => 'civicrm_tell_friend.thankyou_title',
235 'table_name' => 'civicrm_tell_friend',
236 'entity' => 'Friend',
237 'bao' => 'CRM_Friend_BAO_Friend',
238 'localizable' => 1,
239 'html' => [
240 'type' => 'Text',
241 ],
242 ],
243 'thankyou_text' => [
244 'name' => 'thankyou_text',
245 'type' => CRM_Utils_Type::T_TEXT,
246 'title' => ts('Thank You Text'),
247 'description' => ts('Thank you message displayed on success page.'),
248 'where' => 'civicrm_tell_friend.thankyou_text',
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 ],
257 'is_active' => [
258 'name' => 'is_active',
259 'type' => CRM_Utils_Type::T_BOOLEAN,
260 'title' => ts('Enabled?'),
261 'where' => 'civicrm_tell_friend.is_active',
262 'table_name' => 'civicrm_tell_friend',
263 'entity' => 'Friend',
264 'bao' => 'CRM_Friend_BAO_Friend',
265 'localizable' => 0,
266 'html' => [
267 'type' => 'CheckBox',
268 ],
269 ],
270 ];
271 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
272 }
273 return Civi::$statics[__CLASS__]['fields'];
274 }
275
276 /**
277 * Return a mapping from field-name to the corresponding key (as used in fields()).
278 *
279 * @return array
280 * Array(string $name => string $uniqueName).
281 */
282 public static function &fieldKeys() {
283 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
284 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
285 }
286 return Civi::$statics[__CLASS__]['fieldKeys'];
287 }
288
289 /**
290 * Returns the names of this table
291 *
292 * @return string
293 */
294 public static function getTableName() {
295 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
296 }
297
298 /**
299 * Returns if this table needs to be logged
300 *
301 * @return bool
302 */
303 public function getLog() {
304 return self::$_log;
305 }
306
307 /**
308 * Returns the list of fields that can be imported
309 *
310 * @param bool $prefix
311 *
312 * @return array
313 */
314 public static function &import($prefix = FALSE) {
315 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, []);
316 return $r;
317 }
318
319 /**
320 * Returns the list of fields that can be exported
321 *
322 * @param bool $prefix
323 *
324 * @return array
325 */
326 public static function &export($prefix = FALSE) {
327 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, []);
328 return $r;
329 }
330
331 /**
332 * Returns the list of indices
333 *
334 * @param bool $localize
335 *
336 * @return array
337 */
338 public static function indices($localize = TRUE) {
339 $indices = [];
340 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
341 }
342
343 }