Merge pull request #13322 from JMAConsulting/dev-report-5
[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:9c9ee0c8ea79ddd0f680e8050693e5db)
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 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 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 'table_name' => 'civicrm_campaign_group',
105 'entity' => 'CampaignGroup',
106 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
107 'localizable' => 0,
108 ],
109 'campaign_id' => [
110 'name' => 'campaign_id',
111 'type' => CRM_Utils_Type::T_INT,
112 'title' => ts('Campaign'),
113 'description' => ts('Foreign key to the activity Campaign.'),
114 'required' => TRUE,
115 'table_name' => 'civicrm_campaign_group',
116 'entity' => 'CampaignGroup',
117 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
118 'localizable' => 0,
119 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
120 'pseudoconstant' => [
121 'table' => 'civicrm_campaign',
122 'keyColumn' => 'id',
123 'labelColumn' => 'title',
124 ]
125 ],
126 'group_type' => [
127 'name' => 'group_type',
128 'type' => CRM_Utils_Type::T_STRING,
129 'title' => ts('Campaign Group Type'),
130 'description' => ts('Type of Group.'),
131 'maxlength' => 8,
132 'size' => CRM_Utils_Type::EIGHT,
133 'default' => 'NULL',
134 'table_name' => 'civicrm_campaign_group',
135 'entity' => 'CampaignGroup',
136 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
137 'localizable' => 0,
138 'html' => [
139 'type' => 'Select',
140 ],
141 'pseudoconstant' => [
142 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes',
143 ]
144 ],
145 'entity_table' => [
146 'name' => 'entity_table',
147 'type' => CRM_Utils_Type::T_STRING,
148 'title' => ts('Entity Table'),
149 'description' => ts('Name of table where item being referenced is stored.'),
150 'maxlength' => 64,
151 'size' => CRM_Utils_Type::BIG,
152 'default' => 'NULL',
153 'table_name' => 'civicrm_campaign_group',
154 'entity' => 'CampaignGroup',
155 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
156 'localizable' => 0,
157 ],
158 'entity_id' => [
159 'name' => 'entity_id',
160 'type' => CRM_Utils_Type::T_INT,
161 'title' => ts('Entity ID'),
162 'description' => ts('Entity id of referenced table.'),
163 'default' => 'NULL',
164 'table_name' => 'civicrm_campaign_group',
165 'entity' => 'CampaignGroup',
166 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
167 'localizable' => 0,
168 ],
169 ];
170 CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
171 }
172 return Civi::$statics[__CLASS__]['fields'];
173 }
174
175 /**
176 * Return a mapping from field-name to the corresponding key (as used in fields()).
177 *
178 * @return array
179 * Array(string $name => string $uniqueName).
180 */
181 public static function &fieldKeys() {
182 if (!isset(Civi::$statics[__CLASS__]['fieldKeys'])) {
183 Civi::$statics[__CLASS__]['fieldKeys'] = array_flip(CRM_Utils_Array::collect('name', self::fields()));
184 }
185 return Civi::$statics[__CLASS__]['fieldKeys'];
186 }
187
188 /**
189 * Returns the names of this table
190 *
191 * @return string
192 */
193 public static function getTableName() {
194 return self::$_tableName;
195 }
196
197 /**
198 * Returns if this table needs to be logged
199 *
200 * @return bool
201 */
202 public function getLog() {
203 return self::$_log;
204 }
205
206 /**
207 * Returns the list of fields that can be imported
208 *
209 * @param bool $prefix
210 *
211 * @return array
212 */
213 public static function &import($prefix = FALSE) {
214 $r = CRM_Core_DAO_AllCoreTables::getImports(__CLASS__, 'campaign_group', $prefix, []);
215 return $r;
216 }
217
218 /**
219 * Returns the list of fields that can be exported
220 *
221 * @param bool $prefix
222 *
223 * @return array
224 */
225 public static function &export($prefix = FALSE) {
226 $r = CRM_Core_DAO_AllCoreTables::getExports(__CLASS__, 'campaign_group', $prefix, []);
227 return $r;
228 }
229
230 /**
231 * Returns the list of indices
232 *
233 * @param bool $localize
234 *
235 * @return array
236 */
237 public static function indices($localize = TRUE) {
238 $indices = [];
239 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices;
240 }
241
242 }