[NFC] Re-generate DAOs
[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
f29bf4f3 9 * (GenCodeChecksum:5b64d5b0724ee405d4ec21c7a1ce7372)
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
e501603b 74 /**
f41f0342 75 * Returns foreign keys and entity references.
e501603b
TO
76 *
77 * @return array
78 * [CRM_Core_Reference_Interface]
79 */
c3fc2621 80 public static function getReferenceColumns() {
346aaaba 81 if (!isset(Civi::$statics[__CLASS__]['links'])) {
fa45b5b9 82 Civi::$statics[__CLASS__]['links'] = static::createReferenceColumns(__CLASS__);
c3fc2621
CW
83 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Basic(self::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
84 Civi::$statics[__CLASS__]['links'][] = new CRM_Core_Reference_Dynamic(self::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
346aaaba 85 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'links_callback', Civi::$statics[__CLASS__]['links']);
e501603b 86 }
346aaaba 87 return Civi::$statics[__CLASS__]['links'];
e501603b 88 }
c3fc2621 89
e501603b
TO
90 /**
91 * Returns all the column names of this table
92 *
93 * @return array
94 */
c3fc2621 95 public static function &fields() {
346aaaba 96 if (!isset(Civi::$statics[__CLASS__]['fields'])) {
c3fc2621
CW
97 Civi::$statics[__CLASS__]['fields'] = [
98 'id' => [
e501603b
TO
99 'name' => 'id',
100 'type' => CRM_Utils_Type::T_INT,
c3fc2621 101 'title' => ts('Campaign Group ID'),
215b423e 102 'description' => ts('Campaign Group id.'),
c3fc2621 103 'required' => TRUE,
a36434b9 104 'where' => 'civicrm_campaign_group.id',
522a26c9 105 'table_name' => 'civicrm_campaign_group',
106 'entity' => 'CampaignGroup',
107 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 108 'localizable' => 0,
c3fc2621
CW
109 ],
110 'campaign_id' => [
e501603b
TO
111 'name' => 'campaign_id',
112 'type' => CRM_Utils_Type::T_INT,
c3fc2621 113 'title' => ts('Campaign'),
215b423e 114 'description' => ts('Foreign key to the activity Campaign.'),
c3fc2621 115 'required' => TRUE,
a36434b9 116 'where' => 'civicrm_campaign_group.campaign_id',
522a26c9 117 'table_name' => 'civicrm_campaign_group',
118 'entity' => 'CampaignGroup',
119 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 120 'localizable' => 0,
e501603b 121 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
c3fc2621 122 'pseudoconstant' => [
e501603b
TO
123 'table' => 'civicrm_campaign',
124 'keyColumn' => 'id',
125 'labelColumn' => 'title',
e6ca0a57 126 ],
c3fc2621
CW
127 ],
128 'group_type' => [
e501603b
TO
129 'name' => 'group_type',
130 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 131 'title' => ts('Campaign Group Type'),
215b423e 132 'description' => ts('Type of Group.'),
e501603b
TO
133 'maxlength' => 8,
134 'size' => CRM_Utils_Type::EIGHT,
a36434b9 135 'where' => 'civicrm_campaign_group.group_type',
e501603b 136 'default' => 'NULL',
522a26c9 137 'table_name' => 'civicrm_campaign_group',
138 'entity' => 'CampaignGroup',
139 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 140 'localizable' => 0,
c3fc2621 141 'html' => [
e501603b 142 'type' => 'Select',
c3fc2621
CW
143 ],
144 'pseudoconstant' => [
e501603b 145 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes',
e6ca0a57 146 ],
c3fc2621
CW
147 ],
148 'entity_table' => [
e501603b
TO
149 'name' => 'entity_table',
150 'type' => CRM_Utils_Type::T_STRING,
c3fc2621 151 'title' => ts('Entity Table'),
215b423e 152 'description' => ts('Name of table where item being referenced is stored.'),
e501603b
TO
153 'maxlength' => 64,
154 'size' => CRM_Utils_Type::BIG,
a36434b9 155 'where' => 'civicrm_campaign_group.entity_table',
e501603b 156 'default' => 'NULL',
522a26c9 157 'table_name' => 'civicrm_campaign_group',
158 'entity' => 'CampaignGroup',
159 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 160 'localizable' => 0,
c3fc2621
CW
161 ],
162 'entity_id' => [
e501603b
TO
163 'name' => 'entity_id',
164 'type' => CRM_Utils_Type::T_INT,
c3fc2621 165 'title' => ts('Entity ID'),
215b423e 166 'description' => ts('Entity id of referenced table.'),
a36434b9 167 'where' => 'civicrm_campaign_group.entity_id',
e501603b 168 'default' => 'NULL',
522a26c9 169 'table_name' => 'civicrm_campaign_group',
170 'entity' => 'CampaignGroup',
171 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
6a7e5e5d 172 'localizable' => 0,
c3fc2621
CW
173 ],
174 ];
346aaaba 175 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
e501603b 176 }
346aaaba 177 return Civi::$statics[__CLASS__]['fields'];
e501603b 178 }
c3fc2621 179
e501603b 180 /**
bd8e0b14 181 * Return a mapping from field-name to the corresponding key (as used in fields()).
e501603b
TO
182 *
183 * @return array
bd8e0b14 184 * Array(string $name => string $uniqueName).
e501603b 185 */
c3fc2621 186 public static function &fieldKeys() {
bd8e0b14
TO
187 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
188 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
e501603b 189 }
bd8e0b14 190 return Civi::$statics[__CLASS__]['fieldKeys'];
e501603b 191 }
c3fc2621 192
e501603b
TO
193 /**
194 * Returns the names of this table
195 *
196 * @return string
197 */
c3fc2621 198 public static function getTableName() {
e501603b
TO
199 return self::$_tableName;
200 }
c3fc2621 201
e501603b
TO
202 /**
203 * Returns if this table needs to be logged
204 *
c3fc2621 205 * @return bool
e501603b 206 */
c3fc2621 207 public function getLog() {
e501603b
TO
208 return self::$_log;
209 }
c3fc2621 210
e501603b
TO
211 /**
212 * Returns the list of fields that can be imported
213 *
214 * @param bool $prefix
215 *
216 * @return array
217 */
c3fc2621
CW
218 public static function &import($prefix = FALSE) {
219 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign_group', $prefix, []);
60808919 220 return $r;
e501603b 221 }
c3fc2621 222
e501603b
TO
223 /**
224 * Returns the list of fields that can be exported
225 *
226 * @param bool $prefix
227 *
228 * @return array
229 */
c3fc2621
CW
230 public static function &export($prefix = FALSE) {
231 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign_group', $prefix, []);
60808919 232 return $r;
e501603b 233 }
c3fc2621 234
e7a6b91a
AS
235 /**
236 * Returns the list of indices
c3fc2621
CW
237 *
238 * @param bool $localize
239 *
240 * @return array
e7a6b91a
AS
241 */
242 public static function indices($localize = TRUE) {
c3fc2621 243 $indices = [];
e7a6b91a
AS
244 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
245 }
c3fc2621 246
e501603b 247}