Merge pull request #17993 from eileenmcnaughton/mm
[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
a9d0587b 9 * (GenCodeChecksum:a4fa6a19ef72119a316417521e209cd4)
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,
a9d0587b 116 'add' => '3.3',
c3fc2621
CW
117 ],
118 'campaign_id' => [
e501603b
TO
119 'name' => 'campaign_id',
120 'type' => CRM_Utils_Type::T_INT,
c3fc2621 121 'title' => ts('Campaign'),
215b423e 122 'description' => ts('Foreign key to the activity Campaign.'),
c3fc2621 123 'required' => TRUE,
a36434b9 124 'where' => 'civicrm_campaign_group.campaign_id',
522a26c9 125 'table_name' => 'civicrm_campaign_group',
126 'entity' => 'CampaignGroup',
127 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 128 'localizable' => 0,
e501603b 129 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
c3fc2621 130 'pseudoconstant' => [
e501603b
TO
131 'table' => 'civicrm_campaign',
132 'keyColumn' => 'id',
133 'labelColumn' => 'title',
e6ca0a57 134 ],
a9d0587b 135 'add' => '3.3',
c3fc2621
CW
136 ],
137 'group_type' => [
e501603b
TO
138 'name' => 'group_type',
139 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 140 'title' => ts('Campaign Group Type'),
215b423e 141 'description' => ts('Type of Group.'),
e501603b
TO
142 'maxlength' => 8,
143 'size' => CRM_Utils_Type::EIGHT,
a36434b9 144 'where' => 'civicrm_campaign_group.group_type',
e501603b 145 'default' => 'NULL',
522a26c9 146 'table_name' => 'civicrm_campaign_group',
147 'entity' => 'CampaignGroup',
148 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 149 'localizable' => 0,
c3fc2621 150 'html' => [
e501603b 151 'type' => 'Select',
c3fc2621
CW
152 ],
153 'pseudoconstant' => [
e501603b 154 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes',
e6ca0a57 155 ],
a9d0587b 156 'add' => NULL,
c3fc2621
CW
157 ],
158 'entity_table' => [
e501603b
TO
159 'name' => 'entity_table',
160 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 161 'title' => ts('Entity Table'),
215b423e 162 'description' => ts('Name of table where item being referenced is stored.'),
e501603b
TO
163 'maxlength' => 64,
164 'size' => CRM_Utils_Type::BIG,
a36434b9 165 'where' => 'civicrm_campaign_group.entity_table',
e501603b 166 'default' => 'NULL',
522a26c9 167 'table_name' => 'civicrm_campaign_group',
168 'entity' => 'CampaignGroup',
169 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 170 'localizable' => 0,
a9d0587b 171 'add' => '3.3',
c3fc2621
CW
172 ],
173 'entity_id' => [
e501603b
TO
174 'name' => 'entity_id',
175 'type' => CRM_Utils_Type::T_INT,
c3fc2621 176 'title' => ts('Entity ID'),
215b423e 177 'description' => ts('Entity id of referenced table.'),
a36434b9 178 'where' => 'civicrm_campaign_group.entity_id',
e501603b 179 'default' => 'NULL',
522a26c9 180 'table_name' => 'civicrm_campaign_group',
181 'entity' => 'CampaignGroup',
182 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 183 'localizable' => 0,
a9d0587b 184 'add' => '3.3',
c3fc2621
CW
185 ],
186 ];
346aaaba 187 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 188 }
346aaaba 189 return Civi::$statics[__CLASS__]['fields'];
e501603b 190 }
c3fc2621 191
e501603b 192 /**
bd8e0b14 193 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
194 *
195 * @return array
bd8e0b14 196 * Array(string $name => string $uniqueName).
e501603b 197 */
c3fc2621 198 public static function &fieldKeys() {
bd8e0b14
TO
199 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
200 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 201 }
bd8e0b14 202 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 203 }
c3fc2621 204
e501603b
TO
205 /**
206 * Returns the names of this table
207 *
208 * @return string
209 */
c3fc2621 210 public static function getTableName() {
e501603b
TO
211 return self::$_tableName;
212 }
c3fc2621 213
e501603b
TO
214 /**
215 * Returns if this table needs to be logged
216 *
c3fc2621 217 * @return bool
e501603b 218 */
c3fc2621 219 public function getLog() {
e501603b
TO
220 return self::$_log;
221 }
c3fc2621 222
e501603b
TO
223 /**
224 * Returns the list of fields that can be imported
225 *
226 * @param bool $prefix
227 *
228 * @return array
229 */
c3fc2621
CW
230 public static function &import($prefix = FALSE) {
231 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign_group', $prefix, []);
60808919 232 return $r;
e501603b 233 }
c3fc2621 234
e501603b
TO
235 /**
236 * Returns the list of fields that can be exported
237 *
238 * @param bool $prefix
239 *
240 * @return array
241 */
c3fc2621
CW
242 public static function &export($prefix = FALSE) {
243 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign_group', $prefix, []);
60808919 244 return $r;
e501603b 245 }
c3fc2621 246
e7a6b91a
AS
247 /**
248 * Returns the list of indices
c3fc2621
CW
249 *
250 * @param bool $localize
251 *
252 * @return array
e7a6b91a
AS
253 */
254 public static function indices($localize = TRUE) {
c3fc2621 255 $indices = [];
e7a6b91a
AS
256 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
257 }
c3fc2621 258
e501603b 259}