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