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