5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Campaign/CampaignGroup.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:6eb5e63424f42236328b3c11428382e6)
13 * Database access object for the CampaignGroup entity.
15 class CRM_Campaign_DAO_CampaignGroup
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '3.3';
18 const COMPONENT
= 'CiviCampaign';
21 * Static instance to hold the table name.
25 public static $_tableName = 'civicrm_campaign_group';
28 * Should CiviCRM log any modifications to this table in the civicrm_log table.
32 public static $_log = FALSE;
42 * Foreign key to the activity Campaign.
56 * Name of table where item being referenced is stored.
63 * Entity id of referenced table.
72 public function __construct() {
73 $this->__table
= 'civicrm_campaign_group';
74 parent
::__construct();
78 * Returns localized title of this entity.
81 * Whether to return the plural version of the title.
83 public static function getEntityTitle($plural = FALSE) {
84 return $plural ?
ts('Campaign Groups') : ts('Campaign Group');
88 * Returns foreign keys and entity references.
91 * [CRM_Core_Reference_Interface]
93 public static function getReferenceColumns() {
94 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
95 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
96 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'campaign_id', 'civicrm_campaign', 'id');
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Dynamic(self
::getTableName(), 'entity_id', NULL, 'id', 'entity_table');
98 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
100 return Civi
::$statics[__CLASS__
]['links'];
104 * Returns all the column names of this table
108 public static function &fields() {
109 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
110 Civi
::$statics[__CLASS__
]['fields'] = [
113 'type' => CRM_Utils_Type
::T_INT
,
114 'title' => ts('Campaign Group ID'),
115 'description' => ts('Campaign Group id.'),
117 'where' => 'civicrm_campaign_group.id',
118 'table_name' => 'civicrm_campaign_group',
119 'entity' => 'CampaignGroup',
120 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
128 'name' => 'campaign_id',
129 'type' => CRM_Utils_Type
::T_INT
,
130 'title' => ts('Campaign ID'),
131 'description' => ts('Foreign key to the activity Campaign.'),
133 'where' => 'civicrm_campaign_group.campaign_id',
134 'table_name' => 'civicrm_campaign_group',
135 'entity' => 'CampaignGroup',
136 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
138 'FKClassName' => 'CRM_Campaign_DAO_Campaign',
140 'label' => ts("Campaign"),
145 'name' => 'group_type',
146 'type' => CRM_Utils_Type
::T_STRING
,
147 'title' => ts('Campaign Group Type'),
148 'description' => ts('Type of Group.'),
150 'size' => CRM_Utils_Type
::EIGHT
,
151 'where' => 'civicrm_campaign_group.group_type',
153 'table_name' => 'civicrm_campaign_group',
154 'entity' => 'CampaignGroup',
155 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
160 'pseudoconstant' => [
161 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes',
166 'name' => 'entity_table',
167 'type' => CRM_Utils_Type
::T_STRING
,
168 'title' => ts('Entity Table'),
169 'description' => ts('Name of table where item being referenced is stored.'),
171 'size' => CRM_Utils_Type
::BIG
,
172 'where' => 'civicrm_campaign_group.entity_table',
174 'table_name' => 'civicrm_campaign_group',
175 'entity' => 'CampaignGroup',
176 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
181 'name' => 'entity_id',
182 'type' => CRM_Utils_Type
::T_INT
,
183 'title' => ts('Entity ID'),
184 'description' => ts('Entity id of referenced table.'),
185 'where' => 'civicrm_campaign_group.entity_id',
187 'table_name' => 'civicrm_campaign_group',
188 'entity' => 'CampaignGroup',
189 'bao' => 'CRM_Campaign_DAO_CampaignGroup',
194 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
196 return Civi
::$statics[__CLASS__
]['fields'];
200 * Return a mapping from field-name to the corresponding key (as used in fields()).
203 * Array(string $name => string $uniqueName).
205 public static function &fieldKeys() {
206 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
207 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
209 return Civi
::$statics[__CLASS__
]['fieldKeys'];
213 * Returns the names of this table
217 public static function getTableName() {
218 return self
::$_tableName;
222 * Returns if this table needs to be logged
226 public function getLog() {
231 * Returns the list of fields that can be imported
233 * @param bool $prefix
237 public static function &import($prefix = FALSE) {
238 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'campaign_group', $prefix, []);
243 * Returns the list of fields that can be exported
245 * @param bool $prefix
249 public static function &export($prefix = FALSE) {
250 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'campaign_group', $prefix, []);
255 * Returns the list of indices
257 * @param bool $localize
261 public static function indices($localize = TRUE) {
263 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;