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