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