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