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