Merge pull request #10036 from jitendrapurohit/CRM-20329
[civicrm-core.git] / CRM / Friend / DAO / Friend.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/Friend/Friend.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
022785d8 33 * (GenCodeChecksum:f43aa2600521ff0d7c499e9d432dfe8f)
e501603b
TO
34 */
35require_once 'CRM/Core/DAO.php';
36require_once 'CRM/Utils/Type.php';
f41f0342 37/**
38 * CRM_Friend_DAO_Friend constructor.
39 */
e501603b
TO
40class CRM_Friend_DAO_Friend 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_tell_friend';
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 = false;
53 /**
54 * Friend ID
55 *
56 * @var int unsigned
57 */
58 public $id;
59 /**
60 * Name of table where item being referenced is stored.
61 *
62 * @var string
63 */
64 public $entity_table;
65 /**
66 * Foreign key to the referenced item.
67 *
68 * @var int unsigned
69 */
70 public $entity_id;
71 /**
72 *
73 * @var string
74 */
75 public $title;
76 /**
77 * Introductory message to contributor or participant displayed on the Tell a Friend form.
78 *
79 * @var text
80 */
81 public $intro;
82 /**
83 * Suggested message to friends, provided as default on the Tell A Friend form.
84 *
85 * @var text
86 */
87 public $suggested_message;
88 /**
89 * URL for general info about the organization - included in the email sent to friends.
90 *
91 * @var string
92 */
93 public $general_link;
94 /**
95 * Text for Tell a Friend thank you page header and HTML title.
96 *
97 * @var string
98 */
99 public $thankyou_title;
100 /**
101 * Thank you message displayed on success page.
102 *
103 * @var text
104 */
105 public $thankyou_text;
106 /**
107 *
108 * @var boolean
109 */
110 public $is_active;
111 /**
f41f0342 112 * Class constructor.
e501603b
TO
113 */
114 function __construct() {
115 $this->__table = 'civicrm_tell_friend';
116 parent::__construct();
117 }
118 /**
f41f0342 119 * Returns foreign keys and entity references.
e501603b
TO
120 *
121 * @return array
122 * [CRM_Core_Reference_Interface]
123 */
124 static function getReferenceColumns() {
346aaaba
TO
125 if (!isset(Civi::$statics[__CLASS__]['links'])) {
126 Civi::$statics[__CLASS__]['links'] = static ::createReferenceColumns(__CLASS__);
127 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName() , 'entity_id', NULL, 'id', 'entity_table');
128 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 129 }
346aaaba 130 return Civi::$statics[__CLASS__]['links'];
e501603b
TO
131 }
132 /**
133 * Returns all the column names of this table
134 *
135 * @return array
136 */
137 static function &fields() {
346aaaba
TO
138 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
139 Civi::$statics[__CLASS__]['fields'] = array(
e501603b
TO
140 'id' => array(
141 'name' => 'id',
142 'type' => CRM_Utils_Type::T_INT,
143 'title' => ts('Friend ID') ,
144 'description' => 'Friend ID',
145 'required' => true,
522a26c9 146 'table_name' => 'civicrm_tell_friend',
147 'entity' => 'Friend',
148 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
149 ) ,
150 'entity_table' => array(
151 'name' => 'entity_table',
152 'type' => CRM_Utils_Type::T_STRING,
153 'title' => ts('Entity Table') ,
154 'description' => 'Name of table where item being referenced is stored.',
155 'required' => true,
156 'maxlength' => 64,
157 'size' => CRM_Utils_Type::BIG,
522a26c9 158 'table_name' => 'civicrm_tell_friend',
159 'entity' => 'Friend',
160 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
161 ) ,
162 'entity_id' => array(
163 'name' => 'entity_id',
164 'type' => CRM_Utils_Type::T_INT,
165 'title' => ts('Entity ID') ,
166 'description' => 'Foreign key to the referenced item.',
167 'required' => true,
522a26c9 168 'table_name' => 'civicrm_tell_friend',
169 'entity' => 'Friend',
170 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
171 ) ,
172 'title' => array(
173 'name' => 'title',
174 'type' => CRM_Utils_Type::T_STRING,
175 'title' => ts('Title') ,
176 'maxlength' => 255,
177 'size' => CRM_Utils_Type::HUGE,
522a26c9 178 'table_name' => 'civicrm_tell_friend',
179 'entity' => 'Friend',
180 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
181 'html' => array(
182 'type' => 'Text',
183 ) ,
184 ) ,
185 'intro' => array(
186 'name' => 'intro',
187 'type' => CRM_Utils_Type::T_TEXT,
188 'title' => ts('Intro') ,
189 'description' => 'Introductory message to contributor or participant displayed on the Tell a Friend form.',
522a26c9 190 'table_name' => 'civicrm_tell_friend',
191 'entity' => 'Friend',
192 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
193 'html' => array(
194 'type' => 'Text',
195 ) ,
196 ) ,
197 'suggested_message' => array(
198 'name' => 'suggested_message',
199 'type' => CRM_Utils_Type::T_TEXT,
200 'title' => ts('Suggested Message') ,
201 'description' => 'Suggested message to friends, provided as default on the Tell A Friend form.',
522a26c9 202 'table_name' => 'civicrm_tell_friend',
203 'entity' => 'Friend',
204 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
205 'html' => array(
206 'type' => 'Text',
207 ) ,
208 ) ,
209 'general_link' => array(
210 'name' => 'general_link',
211 'type' => CRM_Utils_Type::T_STRING,
212 'title' => ts('General Link') ,
213 'description' => '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 'headerPattern' => '',
219 'dataPattern' => '',
220 'export' => true,
522a26c9 221 'table_name' => 'civicrm_tell_friend',
222 'entity' => 'Friend',
223 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
224 'html' => array(
225 'type' => 'Text',
226 ) ,
227 ) ,
228 'thankyou_title' => array(
229 'name' => 'thankyou_title',
230 'type' => CRM_Utils_Type::T_STRING,
231 'title' => ts('Thank You Title') ,
232 'description' => 'Text for Tell a Friend thank you page header and HTML title.',
233 'maxlength' => 255,
234 'size' => CRM_Utils_Type::HUGE,
522a26c9 235 'table_name' => 'civicrm_tell_friend',
236 'entity' => 'Friend',
237 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
238 'html' => array(
239 'type' => 'Text',
240 ) ,
241 ) ,
242 'thankyou_text' => array(
243 'name' => 'thankyou_text',
244 'type' => CRM_Utils_Type::T_TEXT,
245 'title' => ts('Thank You Text') ,
246 'description' => 'Thank you message displayed on success page.',
522a26c9 247 'table_name' => 'civicrm_tell_friend',
248 'entity' => 'Friend',
249 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
250 'html' => array(
251 'type' => 'Text',
252 ) ,
253 ) ,
254 'is_active' => array(
255 'name' => 'is_active',
256 'type' => CRM_Utils_Type::T_BOOLEAN,
257 'title' => ts('Enabled?') ,
522a26c9 258 'table_name' => 'civicrm_tell_friend',
259 'entity' => 'Friend',
260 'bao' => 'CRM_Friend_BAO_Friend',
e501603b
TO
261 'html' => array(
262 'type' => 'CheckBox',
263 ) ,
264 ) ,
265 );
346aaaba 266 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 267 }
346aaaba 268 return Civi::$statics[__CLASS__]['fields'];
e501603b
TO
269 }
270 /**
bd8e0b14 271 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
272 *
273 * @return array
bd8e0b14 274 * Array(string $name => string $uniqueName).
e501603b
TO
275 */
276 static function &fieldKeys() {
bd8e0b14
TO
277 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
278 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 279 }
bd8e0b14 280 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b
TO
281 }
282 /**
283 * Returns the names of this table
284 *
285 * @return string
286 */
287 static function getTableName() {
288 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
289 }
290 /**
291 * Returns if this table needs to be logged
292 *
293 * @return boolean
294 */
295 function getLog() {
296 return self::$_log;
297 }
298 /**
299 * Returns the list of fields that can be imported
300 *
301 * @param bool $prefix
302 *
303 * @return array
304 */
305 static function &import($prefix = false) {
60808919
TO
306 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, array());
307 return $r;
e501603b
TO
308 }
309 /**
310 * Returns the list of fields that can be exported
311 *
312 * @param bool $prefix
313 *
314 * @return array
315 */
316 static function &export($prefix = false) {
60808919
TO
317 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, array());
318 return $r;
e501603b
TO
319 }
320}