Merge pull request #17669 from seamuslee001/flexmailer_core
[civicrm-core.git] / CRM / Campaign / DAO / CampaignGroup.php
CommitLineData
e501603b 1<?php
c3fc2621 2
e501603b
TO
3/**
4 * @package CRM
ca5cec67 5 * @copyright CiviCRM LLC https://civicrm.org/licensing
e501603b
TO
6 *
7 * Generated from xml/schema/CRM/Campaign/CampaignGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
449c4e6b 9 * (GenCodeChecksum:c245f47a5db1f3cd039da4cf06b667d1)
e501603b 10 */
c3fc2621 11
f41f0342 12/**
c3fc2621 13 * Database access object for the CampaignGroup entity.
f41f0342 14 */
e501603b 15class CRM_Campaign_DAO_CampaignGroup extends CRM_Core_DAO {
c3fc2621 16
e501603b 17 /**
f41f0342 18 * Static instance to hold the table name.
e501603b
TO
19 *
20 * @var string
21 */
fa45b5b9 22 public static $_tableName = 'civicrm_campaign_group';
c3fc2621 23
e501603b 24 /**
f41f0342 25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
e501603b 26 *
c3fc2621 27 * @var bool
e501603b 28 */
fa45b5b9 29 public static $_log = FALSE;
c3fc2621 30
e501603b
TO
31 /**
32 * Campaign Group id.
33 *
e6ca0a57 34 * @var int
e501603b
TO
35 */
36 public $id;
c3fc2621 37
e501603b
TO
38 /**
39 * Foreign key to the activity Campaign.
40 *
e6ca0a57 41 * @var int
e501603b
TO
42 */
43 public $campaign_id;
c3fc2621 44
e501603b
TO
45 /**
46 * Type of Group.
47 *
48 * @var string
49 */
50 public $group_type;
c3fc2621 51
e501603b
TO
52 /**
53 * Name of table where item being referenced is stored.
54 *
55 * @var string
56 */
57 public $entity_table;
c3fc2621 58
e501603b
TO
59 /**
60 * Entity id of referenced table.
61 *
e6ca0a57 62 * @var int
e501603b
TO
63 */
64 public $entity_id;
c3fc2621 65
e501603b 66 /**
f41f0342 67 * Class constructor.
e501603b 68 */
c3fc2621 69 public function __construct() {
e501603b
TO
70 $this->__table = 'civicrm_campaign_group';
71 parent::__construct();
72 }
c3fc2621 73
449c4e6b
CW
74 /**
75 * Returns localized title of this entity.
76 */
77 public static function getEntityTitle() {
78 return ts('Campaign Groups');
79 }
80
e501603b 81 /**
f41f0342 82 * Returns foreign keys and entity references.
e501603b
TO
83 *
84 * @return array
85 * [CRM_Core_Reference_Interface]
86 */
c3fc2621 87 public static function getReferenceColumns() {
346aaaba 88 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 89 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
90 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
91 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 92 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 93 }
346aaaba 94 return Civi::$statics[__CLASS__]['links'];
e501603b 95 }
c3fc2621 96
e501603b
TO
97 /**
98 * Returns all the column names of this table
99 *
100 * @return array
101 */
c3fc2621 102 public static function &fields() {
346aaaba 103 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
104 Civi::$statics[__CLASS__]['fields'] = [
105 'id' => [
e501603b
TO
106 'name' => 'id',
107 'type' => CRM_Utils_Type::T_INT,
c3fc2621 108 'title' => ts('Campaign Group ID'),
215b423e 109 'description' => ts('Campaign Group id.'),
c3fc2621 110 'required' => TRUE,
a36434b9 111 'where' => 'civicrm_campaign_group.id',
522a26c9 112 'table_name' => 'civicrm_campaign_group',
113 'entity' => 'CampaignGroup',
114 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 115 'localizable' => 0,
c3fc2621
CW
116 ],
117 'campaign_id' => [
e501603b
TO
118 'name' => 'campaign_id',
119 'type' => CRM_Utils_Type::T_INT,
c3fc2621 120 'title' => ts('Campaign'),
215b423e 121 'description' => ts('Foreign key to the activity Campaign.'),
c3fc2621 122 'required' => TRUE,
a36434b9 123 'where' => 'civicrm_campaign_group.campaign_id',
522a26c9 124 'table_name' => 'civicrm_campaign_group',
125 'entity' => 'CampaignGroup',
126 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 127 'localizable' => 0,
e501603b 128 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
c3fc2621 129 'pseudoconstant' => [
e501603b
TO
130 'table' => 'civicrm_campaign',
131 'keyColumn' => 'id',
132 'labelColumn' => 'title',
e6ca0a57 133 ],
c3fc2621
CW
134 ],
135 'group_type' => [
e501603b
TO
136 'name' => 'group_type',
137 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 138 'title' => ts('Campaign Group Type'),
215b423e 139 'description' => ts('Type of Group.'),
e501603b
TO
140 'maxlength' => 8,
141 'size' => CRM_Utils_Type::EIGHT,
a36434b9 142 'where' => 'civicrm_campaign_group.group_type',
e501603b 143 'default' => 'NULL',
522a26c9 144 'table_name' => 'civicrm_campaign_group',
145 'entity' => 'CampaignGroup',
146 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 147 'localizable' => 0,
c3fc2621 148 'html' => [
e501603b 149 'type' => 'Select',
c3fc2621
CW
150 ],
151 'pseudoconstant' => [
e501603b 152 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes',
e6ca0a57 153 ],
c3fc2621
CW
154 ],
155 'entity_table' => [
e501603b
TO
156 'name' => 'entity_table',
157 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 158 'title' => ts('Entity Table'),
215b423e 159 'description' => ts('Name of table where item being referenced is stored.'),
e501603b
TO
160 'maxlength' => 64,
161 'size' => CRM_Utils_Type::BIG,
a36434b9 162 'where' => 'civicrm_campaign_group.entity_table',
e501603b 163 'default' => 'NULL',
522a26c9 164 'table_name' => 'civicrm_campaign_group',
165 'entity' => 'CampaignGroup',
166 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 167 'localizable' => 0,
c3fc2621
CW
168 ],
169 'entity_id' => [
e501603b
TO
170 'name' => 'entity_id',
171 'type' => CRM_Utils_Type::T_INT,
c3fc2621 172 'title' => ts('Entity ID'),
215b423e 173 'description' => ts('Entity id of referenced table.'),
a36434b9 174 'where' => 'civicrm_campaign_group.entity_id',
e501603b 175 'default' => 'NULL',
522a26c9 176 'table_name' => 'civicrm_campaign_group',
177 'entity' => 'CampaignGroup',
178 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 179 'localizable' => 0,
c3fc2621
CW
180 ],
181 ];
346aaaba 182 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 183 }
346aaaba 184 return Civi::$statics[__CLASS__]['fields'];
e501603b 185 }
c3fc2621 186
e501603b 187 /**
bd8e0b14 188 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
189 *
190 * @return array
bd8e0b14 191 * Array(string $name => string $uniqueName).
e501603b 192 */
c3fc2621 193 public static function &fieldKeys() {
bd8e0b14
TO
194 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
195 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 196 }
bd8e0b14 197 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 198 }
c3fc2621 199
e501603b
TO
200 /**
201 * Returns the names of this table
202 *
203 * @return string
204 */
c3fc2621 205 public static function getTableName() {
e501603b
TO
206 return self::$_tableName;
207 }
c3fc2621 208
e501603b
TO
209 /**
210 * Returns if this table needs to be logged
211 *
c3fc2621 212 * @return bool
e501603b 213 */
c3fc2621 214 public function getLog() {
e501603b
TO
215 return self::$_log;
216 }
c3fc2621 217
e501603b
TO
218 /**
219 * Returns the list of fields that can be imported
220 *
221 * @param bool $prefix
222 *
223 * @return array
224 */
c3fc2621
CW
225 public static function &import($prefix = FALSE) {
226 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign_group', $prefix, []);
60808919 227 return $r;
e501603b 228 }
c3fc2621 229
e501603b
TO
230 /**
231 * Returns the list of fields that can be exported
232 *
233 * @param bool $prefix
234 *
235 * @return array
236 */
c3fc2621
CW
237 public static function &export($prefix = FALSE) {
238 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign_group', $prefix, []);
60808919 239 return $r;
e501603b 240 }
c3fc2621 241
e7a6b91a
AS
242 /**
243 * Returns the list of indices
c3fc2621
CW
244 *
245 * @param bool $localize
246 *
247 * @return array
e7a6b91a
AS
248 */
249 public static function indices($localize = TRUE) {
c3fc2621 250 $indices = [];
e7a6b91a
AS
251 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
252 }
c3fc2621 253
e501603b 254}