Merge pull request #8624 from saurabhbatra96/validate-api
[civicrm-core.git] / CRM / Friend / DAO / Friend.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2016 |
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
29 * @copyright CiviCRM LLC (c) 2004-2016
30 *
31 * Generated from xml/schema/CRM/Friend/Friend.xml
32 * DO NOT EDIT. Generated by CRM_Core_CodeGen
33 * (GenCodeChecksum:62111759b7ebef1f78bd30c04c2086ba)
34 */
35 require_once 'CRM/Core/DAO.php';
36 require_once 'CRM/Utils/Type.php';
37 class CRM_Friend_DAO_Friend extends CRM_Core_DAO {
38 /**
39 * static instance to hold the table name
40 *
41 * @var string
42 */
43 static $_tableName = 'civicrm_tell_friend';
44 /**
45 * static value to see if we should log any modifications to
46 * this table in the civicrm_log table
47 *
48 * @var boolean
49 */
50 static $_log = false;
51 /**
52 * Friend ID
53 *
54 * @var int unsigned
55 */
56 public $id;
57 /**
58 * Name of table where item being referenced is stored.
59 *
60 * @var string
61 */
62 public $entity_table;
63 /**
64 * Foreign key to the referenced item.
65 *
66 * @var int unsigned
67 */
68 public $entity_id;
69 /**
70 *
71 * @var string
72 */
73 public $title;
74 /**
75 * Introductory message to contributor or participant displayed on the Tell a Friend form.
76 *
77 * @var text
78 */
79 public $intro;
80 /**
81 * Suggested message to friends, provided as default on the Tell A Friend form.
82 *
83 * @var text
84 */
85 public $suggested_message;
86 /**
87 * URL for general info about the organization - included in the email sent to friends.
88 *
89 * @var string
90 */
91 public $general_link;
92 /**
93 * Text for Tell a Friend thank you page header and HTML title.
94 *
95 * @var string
96 */
97 public $thankyou_title;
98 /**
99 * Thank you message displayed on success page.
100 *
101 * @var text
102 */
103 public $thankyou_text;
104 /**
105 *
106 * @var boolean
107 */
108 public $is_active;
109 /**
110 * class constructor
111 *
112 * @return civicrm_tell_friend
113 */
114 function __construct() {
115 $this->__table = 'civicrm_tell_friend';
116 parent::__construct();
117 }
118 /**
119 * Returns foreign keys and entity references
120 *
121 * @return array
122 * [CRM_Core_Reference_Interface]
123 */
124 static function getReferenceColumns() {
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']);
129 }
130 return Civi::$statics[__CLASS__]['links'];
131 }
132 /**
133 * Returns all the column names of this table
134 *
135 * @return array
136 */
137 static function &fields() {
138 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
139 Civi::$statics[__CLASS__]['fields'] = array(
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,
146 ) ,
147 'entity_table' => array(
148 'name' => 'entity_table',
149 'type' => CRM_Utils_Type::T_STRING,
150 'title' => ts('Entity Table') ,
151 'description' => 'Name of table where item being referenced is stored.',
152 'required' => true,
153 'maxlength' => 64,
154 'size' => CRM_Utils_Type::BIG,
155 ) ,
156 'entity_id' => array(
157 'name' => 'entity_id',
158 'type' => CRM_Utils_Type::T_INT,
159 'title' => ts('Entity ID') ,
160 'description' => 'Foreign key to the referenced item.',
161 'required' => true,
162 ) ,
163 'title' => array(
164 'name' => 'title',
165 'type' => CRM_Utils_Type::T_STRING,
166 'title' => ts('Title') ,
167 'maxlength' => 255,
168 'size' => CRM_Utils_Type::HUGE,
169 'html' => array(
170 'type' => 'Text',
171 ) ,
172 ) ,
173 'intro' => array(
174 'name' => 'intro',
175 'type' => CRM_Utils_Type::T_TEXT,
176 'title' => ts('Intro') ,
177 'description' => 'Introductory message to contributor or participant displayed on the Tell a Friend form.',
178 'html' => array(
179 'type' => 'Text',
180 ) ,
181 ) ,
182 'suggested_message' => array(
183 'name' => 'suggested_message',
184 'type' => CRM_Utils_Type::T_TEXT,
185 'title' => ts('Suggested Message') ,
186 'description' => 'Suggested message to friends, provided as default on the Tell A Friend form.',
187 'html' => array(
188 'type' => 'Text',
189 ) ,
190 ) ,
191 'general_link' => array(
192 'name' => 'general_link',
193 'type' => CRM_Utils_Type::T_STRING,
194 'title' => ts('General Link') ,
195 'description' => 'URL for general info about the organization - included in the email sent to friends.',
196 'maxlength' => 255,
197 'size' => CRM_Utils_Type::HUGE,
198 'import' => true,
199 'where' => 'civicrm_tell_friend.general_link',
200 'headerPattern' => '',
201 'dataPattern' => '',
202 'export' => true,
203 'html' => array(
204 'type' => 'Text',
205 ) ,
206 ) ,
207 'thankyou_title' => array(
208 'name' => 'thankyou_title',
209 'type' => CRM_Utils_Type::T_STRING,
210 'title' => ts('Thank You Title') ,
211 'description' => 'Text for Tell a Friend thank you page header and HTML title.',
212 'maxlength' => 255,
213 'size' => CRM_Utils_Type::HUGE,
214 'html' => array(
215 'type' => 'Text',
216 ) ,
217 ) ,
218 'thankyou_text' => array(
219 'name' => 'thankyou_text',
220 'type' => CRM_Utils_Type::T_TEXT,
221 'title' => ts('Thank You Text') ,
222 'description' => 'Thank you message displayed on success page.',
223 'html' => array(
224 'type' => 'Text',
225 ) ,
226 ) ,
227 'is_active' => array(
228 'name' => 'is_active',
229 'type' => CRM_Utils_Type::T_BOOLEAN,
230 'title' => ts('Enabled?') ,
231 'html' => array(
232 'type' => 'CheckBox',
233 ) ,
234 ) ,
235 );
236 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
237 }
238 return Civi::$statics[__CLASS__]['fields'];
239 }
240 /**
241 * Return a mapping from field-name to the corresponding key (as used in fields()).
242 *
243 * @return array
244 * Array(string $name => string $uniqueName).
245 */
246 static function &fieldKeys() {
247 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
248 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
249 }
250 return Civi::$statics[__CLASS__]['fieldKeys'];
251 }
252 /**
253 * Returns the names of this table
254 *
255 * @return string
256 */
257 static function getTableName() {
258 return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
259 }
260 /**
261 * Returns if this table needs to be logged
262 *
263 * @return boolean
264 */
265 function getLog() {
266 return self::$_log;
267 }
268 /**
269 * Returns the list of fields that can be imported
270 *
271 * @param bool $prefix
272 *
273 * @return array
274 */
275 static function &import($prefix = false) {
276 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'tell_friend', $prefix, array());
277 return $r;
278 }
279 /**
280 * Returns the list of fields that can be exported
281 *
282 * @param bool $prefix
283 *
284 * @return array
285 */
286 static function &export($prefix = false) {
287 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'tell_friend', $prefix, array());
288 return $r;
289 }
290 }