5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Friend/Friend.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:1452e2f2b01782f26a30e94bd6af3783)
13 * Database access object for the Friend entity.
15 class CRM_Friend_DAO_Friend
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.0';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_tell_friend';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
41 * Name of table where item being referenced is stored.
48 * Foreign key to the referenced item.
60 * Introductory message to contributor or participant displayed on the Tell a Friend form.
67 * Suggested message to friends, provided as default on the Tell A Friend form.
71 public $suggested_message;
74 * URL for general info about the organization - included in the email sent to friends.
81 * Text for Tell a Friend thank you page header and HTML title.
85 public $thankyou_title;
88 * Thank you message displayed on success page.
92 public $thankyou_text;
102 public function __construct() {
103 $this->__table
= 'civicrm_tell_friend';
104 parent
::__construct();
108 * Returns localized title of this entity.
110 * @param bool $plural
111 * Whether to return the plural version of the title.
113 public static function getEntityTitle($plural = FALSE) {
114 return $plural ?
ts('Friends') : ts('Friend');
118 * Returns foreign keys and entity references.
121 * [CRM_Core_Reference_Interface]
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']);
129 return Civi
::$statics[__CLASS__
]['links'];
133 * Returns all the column names of this table
137 public static function &fields() {
138 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
139 Civi
::$statics[__CLASS__
]['fields'] = [
142 'type' => CRM_Utils_Type
::T_INT
,
143 'title' => ts('Friend ID'),
144 'description' => ts('Friend ID'),
146 'where' => 'civicrm_tell_friend.id',
147 'table_name' => 'civicrm_tell_friend',
148 'entity' => 'Friend',
149 'bao' => 'CRM_Friend_BAO_Friend',
154 'name' => 'entity_table',
155 'type' => CRM_Utils_Type
::T_STRING
,
156 'title' => ts('Entity Table'),
157 'description' => ts('Name of table where item being referenced is stored.'),
160 'size' => CRM_Utils_Type
::BIG
,
161 'where' => 'civicrm_tell_friend.entity_table',
162 'table_name' => 'civicrm_tell_friend',
163 'entity' => 'Friend',
164 'bao' => 'CRM_Friend_BAO_Friend',
169 'name' => 'entity_id',
170 'type' => CRM_Utils_Type
::T_INT
,
171 'title' => ts('Entity ID'),
172 'description' => ts('Foreign key to the referenced item.'),
174 'where' => 'civicrm_tell_friend.entity_id',
175 'table_name' => 'civicrm_tell_friend',
176 'entity' => 'Friend',
177 'bao' => 'CRM_Friend_BAO_Friend',
183 'type' => CRM_Utils_Type
::T_STRING
,
184 'title' => ts('Title'),
186 'size' => CRM_Utils_Type
::HUGE
,
187 'where' => 'civicrm_tell_friend.title',
188 'table_name' => 'civicrm_tell_friend',
189 'entity' => 'Friend',
190 'bao' => 'CRM_Friend_BAO_Friend',
199 'type' => CRM_Utils_Type
::T_TEXT
,
200 'title' => ts('Intro'),
201 'description' => ts('Introductory message to contributor or participant displayed on the Tell a Friend form.'),
202 'where' => 'civicrm_tell_friend.intro',
203 'table_name' => 'civicrm_tell_friend',
204 'entity' => 'Friend',
205 'bao' => 'CRM_Friend_BAO_Friend',
212 'suggested_message' => [
213 'name' => 'suggested_message',
214 'type' => CRM_Utils_Type
::T_TEXT
,
215 'title' => ts('Suggested Message'),
216 'description' => ts('Suggested message to friends, provided as default on the Tell A Friend form.'),
217 'where' => 'civicrm_tell_friend.suggested_message',
218 'table_name' => 'civicrm_tell_friend',
219 'entity' => 'Friend',
220 'bao' => 'CRM_Friend_BAO_Friend',
228 'name' => 'general_link',
229 'type' => CRM_Utils_Type
::T_STRING
,
230 'title' => ts('General Link'),
231 'description' => ts('URL for general info about the organization - included in the email sent to friends.'),
233 'size' => CRM_Utils_Type
::HUGE
,
235 'where' => 'civicrm_tell_friend.general_link',
237 'table_name' => 'civicrm_tell_friend',
238 'entity' => 'Friend',
239 'bao' => 'CRM_Friend_BAO_Friend',
246 'thankyou_title' => [
247 'name' => 'thankyou_title',
248 'type' => CRM_Utils_Type
::T_STRING
,
249 'title' => ts('Thank You Title'),
250 'description' => ts('Text for Tell a Friend thank you page header and HTML title.'),
252 'size' => CRM_Utils_Type
::HUGE
,
253 'where' => 'civicrm_tell_friend.thankyou_title',
254 'table_name' => 'civicrm_tell_friend',
255 'entity' => 'Friend',
256 'bao' => 'CRM_Friend_BAO_Friend',
264 'name' => 'thankyou_text',
265 'type' => CRM_Utils_Type
::T_TEXT
,
266 'title' => ts('Thank You Text'),
267 'description' => ts('Thank you message displayed on success page.'),
268 'where' => 'civicrm_tell_friend.thankyou_text',
269 'table_name' => 'civicrm_tell_friend',
270 'entity' => 'Friend',
271 'bao' => 'CRM_Friend_BAO_Friend',
279 'name' => 'is_active',
280 'type' => CRM_Utils_Type
::T_BOOLEAN
,
281 'title' => ts('Enabled?'),
282 'where' => 'civicrm_tell_friend.is_active',
283 'table_name' => 'civicrm_tell_friend',
284 'entity' => 'Friend',
285 'bao' => 'CRM_Friend_BAO_Friend',
288 'type' => 'CheckBox',
293 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
295 return Civi
::$statics[__CLASS__
]['fields'];
299 * Return a mapping from field-name to the corresponding key (as used in fields()).
302 * Array(string $name => string $uniqueName).
304 public static function &fieldKeys() {
305 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
306 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
308 return Civi
::$statics[__CLASS__
]['fieldKeys'];
312 * Returns the names of this table
316 public static function getTableName() {
317 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
321 * Returns if this table needs to be logged
325 public function getLog() {
330 * Returns the list of fields that can be imported
332 * @param bool $prefix
336 public static function &import($prefix = FALSE) {
337 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'tell_friend', $prefix, []);
342 * Returns the list of fields that can be exported
344 * @param bool $prefix
348 public static function &export($prefix = FALSE) {
349 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'tell_friend', $prefix, []);
354 * Returns the list of indices
356 * @param bool $localize
360 public static function indices($localize = TRUE) {
362 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;