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:21c3b5966a2acba3a68a0ddeeb7c6f50)
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',
158 'name' => 'entity_table',
159 'type' => CRM_Utils_Type
::T_STRING
,
160 'title' => ts('Entity Table'),
161 'description' => ts('Name of table where item being referenced is stored.'),
164 'size' => CRM_Utils_Type
::BIG
,
165 'where' => 'civicrm_tell_friend.entity_table',
166 'table_name' => 'civicrm_tell_friend',
167 'entity' => 'Friend',
168 'bao' => 'CRM_Friend_BAO_Friend',
173 'name' => 'entity_id',
174 'type' => CRM_Utils_Type
::T_INT
,
175 'title' => ts('Entity ID'),
176 'description' => ts('Foreign key to the referenced item.'),
178 'where' => 'civicrm_tell_friend.entity_id',
179 'table_name' => 'civicrm_tell_friend',
180 'entity' => 'Friend',
181 'bao' => 'CRM_Friend_BAO_Friend',
187 'type' => CRM_Utils_Type
::T_STRING
,
188 'title' => ts('Title'),
190 'size' => CRM_Utils_Type
::HUGE
,
191 'where' => 'civicrm_tell_friend.title',
192 'table_name' => 'civicrm_tell_friend',
193 'entity' => 'Friend',
194 'bao' => 'CRM_Friend_BAO_Friend',
203 'type' => CRM_Utils_Type
::T_TEXT
,
204 'title' => ts('Intro'),
205 'description' => ts('Introductory message to contributor or participant displayed on the Tell a Friend form.'),
206 'where' => 'civicrm_tell_friend.intro',
207 'table_name' => 'civicrm_tell_friend',
208 'entity' => 'Friend',
209 'bao' => 'CRM_Friend_BAO_Friend',
216 'suggested_message' => [
217 'name' => 'suggested_message',
218 'type' => CRM_Utils_Type
::T_TEXT
,
219 'title' => ts('Suggested Message'),
220 'description' => ts('Suggested message to friends, provided as default on the Tell A Friend form.'),
221 'where' => 'civicrm_tell_friend.suggested_message',
222 'table_name' => 'civicrm_tell_friend',
223 'entity' => 'Friend',
224 'bao' => 'CRM_Friend_BAO_Friend',
232 'name' => 'general_link',
233 'type' => CRM_Utils_Type
::T_STRING
,
234 'title' => ts('General Link'),
235 'description' => ts('URL for general info about the organization - included in the email sent to friends.'),
237 'size' => CRM_Utils_Type
::HUGE
,
239 'where' => 'civicrm_tell_friend.general_link',
241 'table_name' => 'civicrm_tell_friend',
242 'entity' => 'Friend',
243 'bao' => 'CRM_Friend_BAO_Friend',
250 'thankyou_title' => [
251 'name' => 'thankyou_title',
252 'type' => CRM_Utils_Type
::T_STRING
,
253 'title' => ts('Thank You Title'),
254 'description' => ts('Text for Tell a Friend thank you page header and HTML title.'),
256 'size' => CRM_Utils_Type
::HUGE
,
257 'where' => 'civicrm_tell_friend.thankyou_title',
258 'table_name' => 'civicrm_tell_friend',
259 'entity' => 'Friend',
260 'bao' => 'CRM_Friend_BAO_Friend',
268 'name' => 'thankyou_text',
269 'type' => CRM_Utils_Type
::T_TEXT
,
270 'title' => ts('Thank You Text'),
271 'description' => ts('Thank you message displayed on success page.'),
272 'where' => 'civicrm_tell_friend.thankyou_text',
273 'table_name' => 'civicrm_tell_friend',
274 'entity' => 'Friend',
275 'bao' => 'CRM_Friend_BAO_Friend',
283 'name' => 'is_active',
284 'type' => CRM_Utils_Type
::T_BOOLEAN
,
285 'title' => ts('Enabled?'),
286 'where' => 'civicrm_tell_friend.is_active',
287 'table_name' => 'civicrm_tell_friend',
288 'entity' => 'Friend',
289 'bao' => 'CRM_Friend_BAO_Friend',
292 'type' => 'CheckBox',
297 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
299 return Civi
::$statics[__CLASS__
]['fields'];
303 * Return a mapping from field-name to the corresponding key (as used in fields()).
306 * Array(string $name => string $uniqueName).
308 public static function &fieldKeys() {
309 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
310 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
312 return Civi
::$statics[__CLASS__
]['fieldKeys'];
316 * Returns the names of this table
320 public static function getTableName() {
321 return CRM_Core_DAO
::getLocaleTableName(self
::$_tableName);
325 * Returns if this table needs to be logged
329 public function getLog() {
334 * Returns the list of fields that can be imported
336 * @param bool $prefix
340 public static function &import($prefix = FALSE) {
341 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'tell_friend', $prefix, []);
346 * Returns the list of fields that can be exported
348 * @param bool $prefix
352 public static function &export($prefix = FALSE) {
353 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'tell_friend', $prefix, []);
358 * Returns the list of indices
360 * @param bool $localize
364 public static function indices($localize = TRUE) {
366 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;