Merge pull request #13170 from elisseck/dev/core/485
[civicrm-core.git] / CRM / Friend / DAO / Friend.php
1 <?php
2
3 /**
4 * @package CRM
5 * @copyright CiviCRM LLC (c) 2004-2019
6 *
7 * Generated from xml/schema/CRM/Friend/Friend.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:a0a82714195ed8bafcbb12ef6c829521)
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 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 static $_log = FALSE;
30
31 /**
32 * Friend ID
33 *
34 * @var int unsigned
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 unsigned
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 boolean
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 'table_name' => 'civicrm_tell_friend',
135 'entity' => 'Friend',
136 'bao' => 'CRM_Friend_BAO_Friend',
137 'localizable' => 0,
138 ],
139 'entity_table' => [
140 'name' => 'entity_table',
141 'type' => CRM_Utils_Type::T_STRING,
142 'title' => ts('Entity Table'),
143 'description' => ts('Name of table where item being referenced is stored.'),
144 'required' => TRUE,
145 'maxlength' => 64,
146 'size' => CRM_Utils_Type::BIG,
147 'table_name' => 'civicrm_tell_friend',
148 'entity' => 'Friend',
149 'bao' => 'CRM_Friend_BAO_Friend',
150 'localizable' => 0,
151 ],
152 'entity_id' => [
153 'name' => 'entity_id',
154 'type' => CRM_Utils_Type::T_INT,
155 'title' => ts('Entity ID'),
156 'description' => ts('Foreign key to the referenced item.'),
157 'required' => TRUE,
158 'table_name' => 'civicrm_tell_friend',
159 'entity' => 'Friend',
160 'bao' => 'CRM_Friend_BAO_Friend',
161 'localizable' => 0,
162 ],
163 'title' => [
164 'name' => 'title',
165 'type' => CRM_Utils_Type::T_STRING,
166 'title' => ts('Title'),
167 'maxlength' => 255,
168 'size' => CRM_Utils_Type::HUGE,
169 'table_name' => 'civicrm_tell_friend',
170 'entity' => 'Friend',
171 'bao' => 'CRM_Friend_BAO_Friend',
172 'localizable' => 1,
173 'html' => [
174 'type' => 'Text',
175 ],
176 ],
177 'intro' => [
178 'name' => 'intro',
179 'type' => CRM_Utils_Type::T_TEXT,
180 'title' => ts('Intro'),
181 'description' => ts('Introductory message to contributor or participant displayed on the Tell a Friend form.'),
182 'table_name' => 'civicrm_tell_friend',
183 'entity' => 'Friend',
184 'bao' => 'CRM_Friend_BAO_Friend',
185 'localizable' => 1,
186 'html' => [
187 'type' => 'Text',
188 ],
189 ],
190 'suggested_message' => [
191 'name' => 'suggested_message',
192 'type' => CRM_Utils_Type::T_TEXT,
193 'title' => ts('Suggested Message'),
194 'description' => ts('Suggested message to friends, provided as default on the Tell A Friend form.'),
195 'table_name' => 'civicrm_tell_friend',
196 'entity' => 'Friend',
197 'bao' => 'CRM_Friend_BAO_Friend',
198 'localizable' => 1,
199 'html' => [
200 'type' => 'Text',
201 ],
202 ],
203 'general_link' => [
204 'name' => 'general_link',
205 'type' => CRM_Utils_Type::T_STRING,
206 'title' => ts('General Link'),
207 'description' => ts('URL for general info about the organization - included in the email sent to friends.'),
208 'maxlength' => 255,
209 'size' => CRM_Utils_Type::HUGE,
210 'import' => TRUE,
211 'where' => 'civicrm_tell_friend.general_link',
212 'headerPattern' => '',
213 'dataPattern' => '',
214 'export' => TRUE,
215 'table_name' => 'civicrm_tell_friend',
216 'entity' => 'Friend',
217 'bao' => 'CRM_Friend_BAO_Friend',
218 'localizable' => 0,
219 'html' => [
220 'type' => 'Text',
221 ],
222 ],
223 'thankyou_title' => [
224 'name' => 'thankyou_title',
225 'type' => CRM_Utils_Type::T_STRING,
226 'title' => ts('Thank You Title'),
227 'description' => ts('Text for Tell a Friend thank you page header and HTML title.'),
228 'maxlength' => 255,
229 'size' => CRM_Utils_Type::HUGE,
230 'table_name' => 'civicrm_tell_friend',
231 'entity' => 'Friend',
232 'bao' => 'CRM_Friend_BAO_Friend',
233 'localizable' => 1,
234 'html' => [
235 'type' => 'Text',
236 ],
237 ],
238 'thankyou_text' => [
239 'name' => 'thankyou_text',
240 'type' => CRM_Utils_Type::T_TEXT,
241 'title' => ts('Thank You Text'),
242 'description' => ts('Thank you message displayed on success page.'),
243 'table_name' => 'civicrm_tell_friend',
244 'entity' => 'Friend',
245 'bao' => 'CRM_Friend_BAO_Friend',
246 'localizable' => 1,
247 'html' => [
248 'type' => 'Text',
249 ],
250 ],
251 'is_active' => [
252 'name' => 'is_active',
253 'type' => CRM_Utils_Type::T_BOOLEAN,
254 'title' => ts('Enabled?'),
255 'table_name' => 'civicrm_tell_friend',
256 'entity' => 'Friend',
257 'bao' => 'CRM_Friend_BAO_Friend',
258 'localizable' => 0,
259 'html' => [
260 'type' => 'CheckBox',
261 ],
262 ],
263 ];
264 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
265 }
266 return Civi::$statics[__CLASS__]['fields'];
267 }
268
269 /**
270 * Return a mapping from field-name to the corresponding key (as used in fields()).
271 *
272 * @return array
273 * Array(string $name => string $uniqueName).
274 */
275 public static function &fieldKeys() {
276 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
277 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
278 }
279 return Civi::$statics[__CLASS__]['fieldKeys'];
280 }
281
282 /**
283 * Returns the names of this table
284 *
285 * @return string
286 */
287 public static function getTableName() {
288 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
289 }
290
291 /**
292 * Returns if this table needs to be logged
293 *
294 * @return bool
295 */
296 public function getLog() {
297 return self::$_log;
298 }
299
300 /**
301 * Returns the list of fields that can be imported
302 *
303 * @param bool $prefix
304 *
305 * @return array
306 */
307 public static function &import($prefix = FALSE) {
308 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, []);
309 return $r;
310 }
311
312 /**
313 * Returns the list of fields that can be exported
314 *
315 * @param bool $prefix
316 *
317 * @return array
318 */
319 public static function &export($prefix = FALSE) {
320 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, []);
321 return $r;
322 }
323
324 /**
325 * Returns the list of indices
326 *
327 * @param bool $localize
328 *
329 * @return array
330 */
331 public static function indices($localize = TRUE) {
332 $indices = [];
333 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
334 }
335
336 }