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